Gowtham GS
Gowtham GS

Reputation: 478

How to obtain VisitorToken from RocketChat server

In order to Retrieve a LiveChat Message, REST API requires Visitor Token as one of query parameters. In the documentation, I'm unable to find any hint for generating/obtaining visitor token.

enter image description here

enter image description here

How to obtain visitor token from Rocket Chat server using any API or any documentation regarding this would be of great help?

Upvotes: 0

Views: 448

Answers (1)

Duda Nogueira
Duda Nogueira

Reputation: 552

You can first create the visitor using this API: https://developer.rocket.chat/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/visitor/register-a-new-livechat-visitor

If you do not provide a token at this initial payload, one will be created and return to you.

With the token in hands, you can go ahead and create a new Livechat Room, using this endpoint: https://developer.rocket.chat/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/livechat-room/livechat-room-info

Now, if you already have a registered visitor, you can search for it using this other endpoint: https://developer.rocket.chat/reference/api/rest-api/endpoints/omnichannel/livechat-endpoints/visitor/search-for-visitors

Feel free to drop by our Support Channel

:)

Hope this will help you or others.

Upvotes: 1

Related Questions