Hi, I am new with nextcloud and I would like to use the Talk API but I am totally messed up with the way it works, tried many things but impossible to find a wayā¦
For instance to get conversation it is mentionned :
Base endpoint is: /ocs/v2.php/apps/spreed/api/v1
Method: GET
Endpoint: /chat/{token}
If I have my nexcloud on my unraid on http://192.168.1.66:8666 , does it mean I should use : http://192.168.1.66:8666/ocs/v2.php/apps/spreed/api/v1/chat/{token}
(https://nextcloud-talk.readthedocs.io/en/turn_doc/chat/#chat-api )
Right ?
Where I can find the token and the chat id ?
Thanks a lot for help.
Each conversation has a token. It is generated/returned when the conversation is created: https://nextcloud-talk.readthedocs.io/en/turn_doc/conversation/#creating-a-new-conversation . You can also see it as part of the URL when you enter a conversation in the browser.
Not sure what you mean by chat id?!
wwe
January 16, 2023, 9:39am
3
take a look here for some discussions and references:
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}
Hello,
Iām setting up an application which trigger a call. The user running the app has a dedicated account āalarmā.
When i am executing :
curl -d ā{āflagsā:1}ā -H āOCS-APIRequest: trueā -u āalarm:passwordā āhttps://MYDOMAIN/ocs/v2.php/apps/spreed/api/v1/call/CONVERSATIONTOKEN ā
It sometimes works (returns 200 and trigger a nextcloud talk call) and sometimes doesnt : nextcloud returns a 404 failure (same in apache logs)
I noticed that this is only working if the specific conversation has beeā¦
Hi! I am looking at how to send a message on behalf of a guest user to a conversation where guests are allowed to post. Cannot understand how to do it.
What is working for me is sending on behalf of a registered user:
curl --data '{"token":"<roomid>","message":"hi there"}' -H "Content-Type: application/json" -H "Accept: application/json" -H "OCS-APIRequest: true" -H "Authorization: \"Basic ********=\"" -v -X POST https://mydomain.tld/ocs/v2.php/apps/spreed/api/v1/chat/<roomid>
If I am not proā¦
Thanks for the token. Forget about chat id I mixed up with another API. Thx
Thanks for help. Tried everything prensnted in these post but no lockā¦
is https mandatory because my currently in am with http as shown in my first post ?
Thanks
Can you post the complete request you are sending? Also it makes sense to look at what the browser sends when using the talk app
Thanks again for your timeā¦
Tried many things but this is an example
Tried to insert a picture but it does not work
This is the postman request:
{
"info": {
"_postman_id": "666666666666666666666666666666",
"name": "Talk",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "6666666666666666666666"
},
"item": [
{
"name": "Get Chat",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "OCS-APIRequest",
"value": "true",
"type": "text"
}
],
"url": {
"raw": "http://192.168.1.55:8666/ocs/v2.php/apps/spreed/api/v1/chat/srg5ozy8",
"protocol": "http",
"host": [
"192",
"168",
"1",
"55"
],
"port": "8666",
"path": [
"ocs",
"v2.php",
"apps",
"spreed",
"api",
"v1",
"chat",
"srg5ozy8"
]
}
},
"response": []
}
]
}
{āocsā:{āmetaā:{āstatusā:āfailureā,āstatuscodeā:404,āmessageā:āā},ādataā: }}
You didnāt add any parameters to your request. I think lookIntoFuture is not optional here.
What are you trying to achieve in the end?
Add this to body but nothing better, is https mandatory ?
{
ālookIntoFutureā: 0
}
I would like to use Talk like a clipboard between my iphone, ipad, and pcāsā¦
No, I donāt think so.
So I tried your request, added lookIntoFuture=0
(as a query param!), added basic auth with my login and ran the request, worked perfectly.
Postman:
{
"info": {
"_postman_id": "c7ca79c1-a0c4-4f75-81f3-3c71f2d23c6e",
"name": "Talk",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Get Chat",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "password",
"type": "string"
},
{
"key": "username",
"value": "username",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "OCS-APIRequest",
"value": "true",
"type": "text"
}
],
"url": {
"raw": "http://<yourhost>/ocs/v2.php/apps/spreed/api/v1/chat/<token>?lookIntoFuture=0",
"protocol": "http",
"host": [
"<yourhost>"
],
"path": [
"ocs",
"v2.php",
"apps",
"spreed",
"api",
"v1",
"chat",
"<token>"
],
"query": [
{
"key": "lookIntoFuture",
"value": "0"
}
]
}
},
"response": []
}
]
}
1 Like
You are brilliant and I am dumb! I did not use basic authā¦, thatās better with user/passwordā¦
Last question, I did not find a download command to download attached documents⦠did I miss something? thx again
Well you did not miss it, itās not there ;-). When a file is shared, you get the corresponding parameters (ID, link, etc) in the messageParameters object (see Rich Object String in the Talk docu/ Nextcloud Rich Object Strings Ā· Issue #1706 Ā· nextcloud/server Ā· GitHub ). You can use WebDAV then to download the file. Or maybe https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#direct-download helps you. But download itself is not part of Talk.
Again I can only recommend you to take a look at the requests a browser does, that helps alot.