cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1865
Views
0
Helpful
5
Replies

How to create a webhook for a webex space?

alec990
Cisco Employee
Cisco Employee

I am using a webex application and can create spaces.

How can I create a webhook to post messages to my spaces from an external application?

 

Any pointer would be appreciated.

Thanks

1 Accepted Solution

The page I linked gives you the URL for the POST: https://webexapis.com/v1/messages

The parameters are described at the page. You do not need all off them, mostly I use markdown and either toPersonEmail or roomId, depending on the use case.

The roomId can be fetched by listing all rooms you're in: https://developer.webex.com/docs/api/v1/rooms/list-rooms. Do not use the UUID-form you get from CRTL-SHIFT-K and that can be used for the protocol handlers you mentioned. You have to use the base64 encoded ones as returned by the list-rooms endpoint.

If you want to sent the bot the message to a person directly, you may also specify the mail address instead in the toPersonEmail parameter.

View solution in original post

5 Replies 5

dtibbe
VIP
VIP

A webhook is used to notify your application of an event.

If you want to post something to a space, simply create a bot and use the bot's access token along with https://developer.webex.com/docs/api/v1/messages/create-a-message

Thanks, I have created a bot, got my access token, now I need more help for finding the right POST arguments...

From the space I want to post to, I found the space link which looks like:

 

webexteams://im?space=<uuid>

 

How can I find out the URL to use to post the message? how about roomId, is it the space uuid?

Thanks!

 

The page I linked gives you the URL for the POST: https://webexapis.com/v1/messages

The parameters are described at the page. You do not need all off them, mostly I use markdown and either toPersonEmail or roomId, depending on the use case.

The roomId can be fetched by listing all rooms you're in: https://developer.webex.com/docs/api/v1/rooms/list-rooms. Do not use the UUID-form you get from CRTL-SHIFT-K and that can be used for the protocol handlers you mentioned. You have to use the base64 encoded ones as returned by the list-rooms endpoint.

If you want to sent the bot the message to a person directly, you may also specify the mail address instead in the toPersonEmail parameter.

Ahhh, thanks for the clarification, it makes sense now,

I did not know that the panel on the right side was live on actual webex spaces! Clever!

I managed to send a message to my space, thank you!

 

One extra step that is needed and was not documented, is that the bot email address must be explicitly added to the space.

I failed to do that and got this error message:

 

Error postMessage failed: request failed with status code 404, {"message":"Could not find a room with provided ID.","errors"...

I thought my roomID was wrong!

 

 

 

 

Getting Started

Welcome to the Webex Community. This is your home to ask questions, share knowledge, and attend live webinars.