Automation webhooks within Elements combined with Webex Bots serve as a powerful tool that enables sending Elements events to Webex channels as messages, facilitating better collaboration and information sharing.

Create a Bot in the Webex Developer Portal

  1. Create a new Webex Bot at https://developer.webex.com/my-apps/new/bot.

  2. Enter a display name for the bot in Webex.

  3. Create a unique username for the bot; for example, mycompany.elements@webex.bot.

  4. Select or upload an icon for the bot.

  5. Provide a description for the bot. This information will remain private unless the bot is submitted to the Webex App Hub. We recommend against submitting it to the Webex App Hub, since this bot is intended solely for use within your organization.

  6. Select Add Bot. A Bot Access Token will be generated. Save this token to be used to configure the automation webhook in Elements.

Invite the Bot to Webex Messaging

  1. Webhooks will be sent to your chosen Messaging Space. However, the bot will need to be first invited as a participant.

  2. Open the Messaging Space, navigate to the People tab, and select Add people.

  3. Enter the bot username previously created, and select Add.

  4. The bot now has permission to send messages to the space.

Retrieve the Webex Room ID

  1. Before configuring the webhook, obtain the ID of the Message Space (also known as the roomId).

  2. Open the Messaging Space and select the gear configuration icon.

  3. Select Copy space link, then paste the link into a text editor.
    The link will appear similar to as follows, but with your unique space/room ID:
    webexteams://im?space=e8ad105f-895a-4873-a1f1-7beda6d4490b

  4. Remove the prefix, leaving only the ID (e.g., e8ad105f-895a-4873-a1f1-7beda6d4490b). This ID will be used in your template in the next step.

Configure the Automation Webhook in Elements

  1. In Elements, navigate to the Automations page.

  2. Create a new automation. Select a trigger that encompasses the event types to be sent to Webex.

  3. Add an action to Execute Custom Webhook.

  4. For the webhook URL, enter https://webexapis.com/v1/messages

  5. Include a custom header formatted as follows: Authorization: Bearer <BOT_ACCESS_TOKEN>

    1. Simply paste the token in place of <BOT_ACCESS_TOKEN> after the space following "Bearer" (without the angle brackets).

  6. Webex supports the Adaptive Card schema, which allows for customization to meet your needs. Use the template below as a starting point.

    1. Replace <YOUR_ROOM_ID> with the roomId obtained above.

    2. Refer to the Custom Webhooks documentation for additional information.

{
"roomId": "<YOUR_ROOM_ID>",
"text": "Elements Event",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.3",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "{{context.trigger.eventTypeLocalized}}",
"weight": "bolder",
"wrap": true
},
{
"type": "TextBlock",
"spacing": "none",
"text": "{{context.trigger.dateTimeLong}}",
"isSubtle": true,
"wrap": true
}
]
}
]
}
]
},
{
"type": "Container",
"items": [
{
"type": "FactSet",
"facts": [
{
"title": "Reader:",
"isVisible": true,
"value": "{{context.trigger.device.name}}"
},
{
"title": "Space:",
"isVisible": true,
"value": "{{context.trigger.space.name}}"
},
{
"title": "Person:",
"isVisible": true,
"value": "{{context.trigger.person.firstName}} {{context.trigger.person.lastName}}"
}
]
}
]
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "View Event",
"url": "https://portal.elementssecure.com/events/{{context.trigger.id}}?activeCustomer={{context.trigger.customerId}}"
}
]
}
}
]
}