LiveChat - assign User

Hi,

I have an application where I want to place the LiveChat Widget.

I want to use “external service” an trigger “Voxtron”.
“external service” is required to respond with a username, which I dont have at this point.
I will ask Voxtron to create a new contact … and some time later asynchronosly I can retrieve the userId. How can I use this with “external service”?

  • whats the timeout of “external service” … can this busy wait for minutes?
  • can I assign the chat to a dummy user
    and via some REST API calll (which one?) reassign the LiveChat to the user which has been selected by voxtron?

Hi!

I guess you are talking about the omnichannel routing method, right?
for this configuration, you will indeed have the user at the response time.

I think the timeout is based the default and not configured per this webhook. The code lives here:

You can try the dummy user approach, and would have to use this API to transfer/handoff/handover the omnichannel chat to a department later:

Note that the API will transfer to a department, if for a user, use this API:

THanks!

I guess you are talking about the omnichannel routing method, right?

yes. This one:
h…ttps://docs.rocket.chat/guides/administration/settings/omnichannel-admins-guide/queue-types-routing-algorithm#external-service

For the dummy+forwarding the API wants IDs, not just usernames.
Do you suggest these APIs to get hold of the Ids:

/api/v1/livechat/rooms

/api/v1/livechat/users/agent

Can you give me advice regarding roomId? I just want to give the customer to some Agent. How is the room concept involved here?

the room is where the omnichannel chat take places.

whenever you navigate into Omnichannel > Current Chats and click on chat, the url will show the room current room id.

new solution idea:

in liveChat assign: i will set to “manual”

for transferring a user I need:

I will activate: Omnichannel CRM Integration - “on new chat”
h…ttps://github.com/RocketChat/Rocket.Chat/blob/4b408c2ddea118fad49fe1e5949f79154ad0c1b7/app/livechat/server/hooks/sendToCRM.js#L124

the request body seems to contain the roomId
h…ttps://github.com/RocketChat/Rocket.Chat/blob/2f405cb944aa6c86eba19bbe96a491f2dafd5f93/app/livechat/server/lib/Livechat.js#L822

in the “CRM”
I can ask Voxtron to create a new contact

In the Voxtron client, when the contact arrives asynchronously I finally know the agent-username which has been selected by voxton

How can I convert agent-username to userId?
I have found this undocumented query param:
HTTP GET /api/v1/livechat/users/agent?text=someUsername
the response contains the userId

Hi!

That’s a great solution!

You will need this API to fetch agent’s id from the username

something like:

curl --request GET \
  --url 'http://localhost:3000/api/v1/users.info?username=agent1' \
  --header 'X-Auth-Token: BEXgICtWSkz6R5Masu2M_KtBoSGpvzY_vVvJPv3Pi9u' \
  --header 'X-User-Id: avmX38wqkezv55obK'

of course, with your own personal access token information and the user with proper permissions.