350-901 · Question #64
Refer to the exhibit. Which set of API requests must be executed by a Webex Teams bot after receiving webhook callback to process messages in a room and reply with a new message back to the same room?
The correct answer is D. GET /message&roomId=<ROOM_ID> POST /messages {"roomId":"<ROOM_ID>", "text":"<MESSAGE>"}. A Webex Teams bot must GET messages in the room to read the incoming message, then POST a new message to reply - using POST because it creates a new resource.
Question
Exhibit
Options
- AGET /message&roomId=<ROOM_ID> POST /messages {"roomId":"<ROOM_ID>", "text":"<MESSAGE>"}
- BGET /messages&mentionedPeople=me&roomId=<ROOM_ID> PUT /messages {"roomId":"<ROOM_ID>", "text":"<MESSAGE>"}
- CGET /message&roomId=<ROOM_ID> PUT /messages {"roomId":"<ROOM_ID>", "text":"<MESSAGE>"}
- DGET /message&roomId=<ROOM_ID> POST /messages {"roomId":"<ROOM_ID>", "text":"<MESSAGE>"}
How the community answered
(44 responses)- A9% (4)
- B2% (1)
- C5% (2)
- D84% (37)
Why each option
A Webex Teams bot must GET messages in the room to read the incoming message, then POST a new message to reply - using POST because it creates a new resource.
Choice A incorrectly uses a singular '/message' endpoint that does not exist in the Webex Teams API; the correct endpoint is '/messages' (plural).
PUT /messages is incorrect because PUT updates an existing resource; replying to a room requires creating a new message with POST, and the mentionedPeople filter is unnecessary for a basic room reply.
Choice C uses both an incorrect singular endpoint '/message' and PUT instead of POST, neither of which is valid for sending a new reply message in Webex Teams.
After receiving a webhook callback, the bot retrieves the room's messages using GET /messages with the roomId query parameter to read the triggering message, then sends a reply by creating a new message resource with POST /messages including the roomId and text in the request body.
Concept tested: Webex Teams bot GET and POST messages API workflow
Source: https://developer.webex.com/docs/api/v1/messages
Topics
Community Discussion
No community discussion yet for this question.
