How to use Write API to chat with user in a chat room
-
Hi,
I tried to user Write API`s chat route /api/v1/users/<uid>/chats in order to chat with user using a bot. However every time when I am sending a message, it is creating a new chatroom. The POST operation onto /api/v1/users/<uid>/chats is creating a chat room & returning its id.{"code":"ok","payload":{"content":"<p>Hello</p>\n","timestamp":1498844643722,"fromuid":18,"roomId":8,"messageId":133,"fromUser":{"username":"mbatious","userslug":"mbatious","picture":"/uploads/profile/18-profileimg.png","status":"offline","uid":18,"icon:text":"M","icon:bgColor":"#f44336"},"self":1,"timestampISO":"2017-06-30T17:44:03.722Z","newSet":true,"cleanedContent":"Hello\n","mid":133}}
However I am not finding a way use this roomId in further messages. The only parameters accepted in /api/v1/users/<uid>/chats API are message, timestamp & quiet. How to continue chat in a previously created room?
-
No such function yet. Sorry.
-
I think so, I'll take a look.
-
Kinda got over-excited. Basically, just added a parameter
roomId
to the existing route. If it exists, it posts to the existing room. -
Thanks @yariplus, I also found this very useful.