Help with NextTalk Chat API

Can anyone help me with sending a new chat message using curl and API. I cannot figure out how to get the token…

  • Method: POST
  • Endpoint: /chat/{token}

Well I can’t help you with a straight answer, but I have the same issue.
I assume your complete REST URL is something like:{token}

I assume {token} is the room IT, which you can retrieve from the URL, when you select the chat room. In my case it is something like 59jpu5c9.

Though you still have to login. See here: to get it all working.

Though, you can post as guest. That is what I want to do. I haven’t succeeded yet…

1 Like

As an addition to @Bubbel s comment:
I managed to send a message as a logged-in user with curl like this.
As he said, the token is the identifier of the chat room (i found it in the URL of a chat window on my desktop). It’s used twice, once in the payload and once in the url to call.

-v makes output verbose, you’ll want to remove that
-u uses an App-Password you need to generate beforehand for the user account you want to use.

curl -d '{"token": "<nohu63se>", "message": "hi there @<username>}' -H "Content-Type: application/json" -H "Accept: application/json" -H "OCS-APIRequest: true" -v -u "<botusername>:<§%$verylongAppPasswordOfBotUser$%&>" https://<yourHost.YourUrl>/ocs/v2.php/apps/spreed/api/v1/chat/<nohu63se>

You’ll have to adapt everything between <>
There’s also an issue on github about the same:


Yes, this absolutely works, except for the typo (missing a double quote, between the message text and the curly brackets).

Thank you for showing the way.
I’ve taken the liberty to put it all in a bash script, for easy usage, but I haven’t been able to post it here in a correct fashion, without it getting garbled (wrong quoting, missing backslashes, etc.

I will look into it an post when I know how.

1 Like

Great ! it works … thanks all

Is there a way to post an image or video to a chat? I didn’t see a way to do this via the Talk API. Or maybe post a URL and have it automatically “unfurled” (previewed)? If I can’t upload media directly into the chat I’ll probably look into uploading media with the usual nextcloud webdav API then posting a message with the URL of same in the Talk (spreed) chat.

Does somebody managed to send Message in a room as a guest. With help of the curl command ob @sebarian I managed to send a Message as a logged in user. But I want to send message as guest with different name.

Thank you in advance!

Here is a simple chat bot i created. It listens to the chat and reply (tags whoever asked him in a conversation) with some pre programmed commands. May be helpful to someone!
nk-free-lab/nextcloud_chat_bot.php at master · reekol/nk-free-lab · GitHub

Yep. There is a way, similar to the one you described. Look at ‘cam’ or ‘dvr’ section inside this script -> nk-free-lab/nextcloud_chat_bot.js at master · reekol/nk-free-lab · GitHub

@tml89 did you made any progress on anonymous chat messages?

Nö, unfortunately not. But I investigated no time

Thanks again for this. The ocs/v2.php/apps/files_sharing/api/v1/shares (“share file to chat”) endpoint you pointed me towards worked well! Users see the actual media, not just a link–this is exactly what I was hoping for.

Related, for posterity:

We might also see unfurling eventually. See: External link preview · Issue #3156 · nextcloud/spreed · GitHub

1 Like