Livechat api notification

Hi
I have a technical/api question.
Our client is using Livechat on a high volume site. There are too many inbound visitors for the Agents to start a conversation for all of them. So we want the Agent to focus on a specific country or region.
So we want to notify the Agent, when the visitors are from a range of IP addresses.
We have been looking into the Rest api.
We found the api that us the chat_id and IP address of visitor.
(https://developers.livechatinc.com/docs/rest-api/#list-all-visitors). So we can select the chats based on IP range.
The question is

  1. how do we generate a message or an alert or a notification to an Agent
  2. how do we tell the Agent the Chat_id or the IP address.
    Any suggestion will be appreciated.
    Andrew

Hi @andrew_smaudience,

What we would suggest is to detect the country of origin of a visitor with third party software like Geoip or https://ipstack.com/ in the frontend.

After that - load a chat widget with a specific group of agents that takes care of that specific country.

To make it work, it’s important to set the right group before the chat widget loads.

This is an example that illustrates what we have in mind:

view-source:http://lcsupport.ehost.pl/mp/sites/geolocation.php

(please, copy the link from the word view)

Hope it helps!

Hi Daria
Thanks for this. Will ask the dev team to follow this architecture
Andrew

1 Like

Hey Daria, this thread is just a few months old, but it appears the shared source isn’t loading anymore. This is exactly what we’re trying to do with one of our new companies. They’re dropping Intercom and switching to LiveChat with us, but they want to keep their original geolocationing that they had set up for each state. Have you guys had any further progress on this on your guys side? I’m assuming I’ll still need to use a geolocating api, but I wasn’t sure if I could piggyback off anything you guys have already implemented since you guys already obtain the customers IP as far as I can tell, and I’ve seen within the chatbot that you guys have it already obtaining the info I need to access. Screen Shot 2020-01-06 at 4.56.41 PM

Actually, it looks like it shows up in LiveChat as well. How do I leverage this data from you guys since it’s already being obtained?Screen Shot 2020-01-06 at 5.40.27 PM

Hey to achieve what you want you could use data available in LiveChat but it would require extra work on your side. I believe using third-party geolocation software would be much simpler, but it is up to you ;).

You would have to prepare endpoint that would return the information you need. To get the information regarding a customer, you need his id. To get it, you can use one of the methods of our API provided by the chat widget - LC_API.get_visitor_id().

Now when you have customer id use it to call the get_customers method ( on the backend side of your website ) from the Agent API like this:

curl --location --request POST 'https://api.livechatinc.com/v3.1/agent/action/get_customers' \
--header 'Authorization: Bearer dal:x' \
--header 'Content-Type: application/json' \
--data-raw '{
	"filters": {
			"customer_id": {
				"values":["x-x-x-x-x"]
			}
	}
}'

You can extract geolocation data from the payload and return it to the webpage.

Now all you need to do is to destroy chat widget and load it again with the correct group.

To achieve the last point, you would have to use different chat widget snippet than you are using now. If you are interested in this solution, please PM me :wink:

2 Likes