Skip to content

Webex Teams Binding ​

The Webex Teams binding lets you send messages to Webex Teams users and rooms via rule actions.

Messages can use Markdown, and attachments are supported.

Supported Things ​

  • account: A Webex Teams account

Discovery ​

No Things are discovered by this binding.

Thing Configuration ​

Webex supports two main types of app integration:

  • Bot: a separate identity that can communicate with people and rooms.
  • Person integration: an OAuth integration that allows the binding to act on behalf of a person.

Both account types must be created first on the Webex Developers website. When creating a person integration, customize the redirect URL based on your openHAB installation. For example, if your openHAB server runs at http://openhab:8080, add http://openhab:8080/connectwebex to the redirect URIs.

To use a bot account, configure only the token (bot access token).

To use a person integration, configure clientId and clientSecret. After the account is configured as a Thing in openHAB, navigate to the redirect URL (as described above) and authorize your account.

Do not configure both a bot token (used for bots) and clientId/clientSecret (used for person integrations). If both are set, the binding uses the token.

A default room ID is required for the sendMessage action.

account Thing Configuration ​

NameTypeDescriptionDefaultRequiredAdvanced
tokentext(Bot) authentication tokenN/Anono
clientIdtext(Person) client IDN/Anono
clientSecrettext(Person) client secretN/Anono
refreshPeriodintegerRefresh period for channels (seconds)300nono
roomIdtextID of the default roomN/Anono

Channels ​

ThingChannelTypeDescription
Webex Teams AccountstatusStringAccount presence status: active, call, inactive, ...
Webex Teams AccountlastactivityDateTimeThe date and time of the person's last activity within Webex.

Note: The status and lastactivity channels are updated only for person integrations.

Full Example ​

webexteams.things:

Configure a bot account:

dsl
Thing webexteams:account:bot [ token="XXXXXX", roomId="YYYYYY" ]

Configure a person integration account:

dsl
Thing webexteams:account:person [ clientId="XXXXXX", clientSecret="YYYYYY", roomId="ZZZZZZ" ]

Rule Actions ​

DSL rules use getActions to obtain a reference to the Thing.

val botActions = getActions("webexteams", "webexteams:account:bot")

This binding includes these rule actions for sending messages:

  • var success = botActions.sendMessage(String markdown) - Send a message to the default room.
  • var success = botActions.sendMessage(String markdown, String attach) - Send a message to the default room, with attachment.
  • var success = botActions.sendRoomMessage(String roomId, String markdown) - Send a message to a specific room.
  • var success = botActions.sendRoomMessage(String roomId, String markdown, String attach) - Send a message to a specific room, with attachment.
  • var success = botActions.sendPersonMessage(String personEmail, String markdown) - Send a direct message to a person.
  • var success = botActions.sendPersonMessage(String personEmail, String markdown, String attach) - Send a direct message to a person, with attachment.

Sending messages for bot or person accounts works exactly the same. Attachments must be public URLs. Sending local files isn't supported.