- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2022 06:58 AM
This is the first bot I'm working on. I got my bot ID and bearer. I'm using them as follows:
BOTB=thelongbearerstring
BOTID=thelongidstring
MESSAGE="hello world"
curl --silent \
--show-error \
-X POST https://webexapis.com/v1/messages \
--header "Authorization: Bearer $BOTB"
--header "Content-Type: multipart/form-data" \
--form "roomId=$BOTID" \
--form "markdown=*$MESSAGE*"
This returns the following error message:
{"message":"The requested resource could not be found.","errors":[{"description":"The requested resource could not be found."}],"trackingId":"ROUTER_****"}%
If I use an exiting bots details the curl works, no errors.
Solved! Go to Solution.
- Labels:
-
Webex Bots
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2022 07:39 AM
@László I might be reading this wrong, but based on your description it looks like that your bot is trying to send a message to itself? You are using the bot ID as the room ID and then you are POSTing a message to that room ID using the bot's access token? I just tested the below and that worked for me:
curl --request POST \
--header "Authorization: Bearer ACCESS_TOKEN" \
--form "roomId=ROOM_ID" \
--form "text=example" \
https://webexapis.com/v1/messages
Also, the room ID is not the same as the people ID, you will need to look it up here https://developer.webex.com/docs/api/v1/rooms .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2022 01:53 AM
This command showed me what I need. Good!
curl --silent -X GET "https://webexapis.com/v1/rooms" --header "Authorization: Bearer $ACCESS_TOKEN"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2022 02:39 AM
@László szívesen! About finding the room ID in the Webex client. It will be a bit trickier, because the clients only use the unencoded UUID of a room, while the APIs are using encoded UUIDs. You can get the UUID in the Webex client like this:
On Windows use Ctrl + Shift + K
On Mac use Option + Command + K
You can still convert a unencoded UUID into an encoded API ID like this:
- get the ID of a random room that you are a member of with https://developer.webex.com/docs/api/v1/rooms/list-rooms
- decode the ID using base64 (it will be something like this ciscospark://us/ROOM/d2fde090-9d0c-11e5-aeed-2176fdcd8a58)
- replace the part after ROOM/ with your unencoded UUID from the Webex client
- base64 encode it to get something like this Y2lzY29zcGFyazovL3VzL1JPT00vZDJmZGUwOTAtOWQwYy0xMWU1LWFlZWQtMjE3NmZkY2Q4YTU4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2022 07:39 AM
@László I might be reading this wrong, but based on your description it looks like that your bot is trying to send a message to itself? You are using the bot ID as the room ID and then you are POSTing a message to that room ID using the bot's access token? I just tested the below and that worked for me:
curl --request POST \
--header "Authorization: Bearer ACCESS_TOKEN" \
--form "roomId=ROOM_ID" \
--form "text=example" \
https://webexapis.com/v1/messages
Also, the room ID is not the same as the people ID, you will need to look it up here https://developer.webex.com/docs/api/v1/rooms .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2022 01:07 AM
Köszönöm szépen!
This has helped, thank you!
Do you know how can I find out a room's ID in Webex? I tried "Copy Space Link" but that's not it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2022 02:39 AM
@László szívesen! About finding the room ID in the Webex client. It will be a bit trickier, because the clients only use the unencoded UUID of a room, while the APIs are using encoded UUIDs. You can get the UUID in the Webex client like this:
On Windows use Ctrl + Shift + K
On Mac use Option + Command + K
You can still convert a unencoded UUID into an encoded API ID like this:
- get the ID of a random room that you are a member of with https://developer.webex.com/docs/api/v1/rooms/list-rooms
- decode the ID using base64 (it will be something like this ciscospark://us/ROOM/d2fde090-9d0c-11e5-aeed-2176fdcd8a58)
- replace the part after ROOM/ with your unencoded UUID from the Webex client
- base64 encode it to get something like this Y2lzY29zcGFyazovL3VzL1JPT00vZDJmZGUwOTAtOWQwYy0xMWU1LWFlZWQtMjE3NmZkY2Q4YTU4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2022 01:53 AM
This command showed me what I need. Good!
curl --silent -X GET "https://webexapis.com/v1/rooms" --header "Authorization: Bearer $ACCESS_TOKEN"
