Bot API message endpoint does not return message_id
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.2k
- Forks
- 586
- Avg merge
- 18h 27m
- Merged PRs (30d)
- 333
Description
When a bot posts a message via POST /ocs/v2.php/apps/spreed/api/v1/bot/{token}/message,
the response appears to always be DataResponse(null) with HTTP 201.
As far as I can tell, the message is created internally
($comment = $this->chatManager->sendMessage(...) in BotController.php, line ~160),
but the comment data is not serialised into the response.
This means there seems to be no way for the caller to obtain the message_id of the posted
message. Without it, building reply-chains or dialog bindings is not straightforward —
as a workaround, the bot has to scan incoming webhook payloads for its own text.
It would be great if the response included at least { "id": <message_id> }, analogous
to the chat message API.
Relevant code: lib/Controller/BotController.php, line ~184:
return new DataResponse(null, Http::STATUS_CREATED);
Talk version: 23.0.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/Controller/BotController.php around the sendMessage call near line 160 and the DataResponse return near line 184. Trace how the created comment is represented and compare the response with the chat message API. Done means POST /ocs/v2.php/apps/spreed/api/v1/bot/{token}/message returns the created message_id instead of null.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100