Skip to content

Webex Messaging Integration

The webexOperations.js file provides functionality for sending alarm notifications to Webex rooms. Below is an overview of the key functions and their purposes:

Functions

1. sendWebexMessage

  • Purpose: Sends a message to a Webex room.
  • Parameters:
  • text: The plain text message to send.
  • markdown: The markdown formatted message to send.
  • Details:
  • Uses the Webex Bot token (SERVICE_WEBEX_BOT_TOKEN) for authentication.
  • Sends the message to the room specified by SERVICE_WEBEX_GROUPID.
  • Logs errors if the request fails.

2. sendAlarmActivated

  • Purpose: Sends a notification when an alarm is activated.
  • Details:
  • Generates a text and markdown message using getSendAlarmText.
  • Sends the message to Webex using sendWebexMessage.
  • Optionally sends an email notification if sendemail or sendEmail is true.

3. sendAlarmDeactivated

  • Purpose: Sends a notification when an alarm is deactivated.
  • Details:
  • Generates a text and markdown message based on the alarm details.
  • Sends the message to Webex using sendWebexMessage.
  • Optionally sends an email notification if sendemail or sendEmail is true.

Environment Variables

The following environment variables are required for Webex messaging: - SERVICE_WEBEX_BOT_TOKEN: The token for authenticating the Webex Bot. - SERVICE_WEBEX_GROUPID: The ID of the Webex room where messages will be sent.

Message Format

  • Text: A plain text summary of the alarm.
  • Markdown: A detailed message with alarm information, formatted using markdown.

Error Handling

  • Logs errors if the Webex API request fails.
  • Logs debug messages for successful message delivery.