nextcloud / nextcloud/spreed

Bot API message endpoint does not return message_id

Open Beginner friendly
#17,773 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature: api 🛠️ feature: bots 🤖
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.