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.
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 .
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"
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:
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 .
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.
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:
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"
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide