Send a message via a local URL
Hello, I wanted to ask if there's a way to send a message via a local URL (e.g., http://localhost:3000/...). If so, could you please provide the URL structure? Thank you in advance for your help.
Hi
POST to url: http://localhost:3000/client/sendMessage/ABCD
-H 'x-api-key: <Key>'
Body:
{
"chatId": "[email protected]",
"contentType": "string",
"content": "Test Message"
}
It works using https://www.usebruno.com/downloads But i'm not sure why it does not work from command prompt using curl URL rejected: Bad hostname Get methods work from the browser
Let me know if yours works from curl
Thanks
This works for me:
curl -X 'POST'
'http://localhost:3000/client/sendMessage/<sessionID>'
-H 'accept: /'
-H 'Content-Type: application/json'
-d '{
"chatId": "[email protected]",
"contentType": "string",
"content": "Test Message"
}'
Just to be on the safe side you may want to check your session status first...
curl -X 'GET'
'http://localhost:3000/session/status/<sessionID>'
-H 'accept: application/json'
I named my sessionID default so the command that I'm running is:
curl -X 'GET'
'http://locahost:3000/session/status/default'
-H 'accept: application/json'
you should receive a response like this: {"success":true,"state":"CONNECTED","message":"session_connected"}