shirisha
(shirisha)
February 2, 2022, 2:54pm
#1
statusCode: 422,
error: ‘{“error”:“Unprocessable Entity”}’,
options: {
method: ‘GET’,
uri: ‘https://api.livechatinc.com/visitors/u-a7e5fd6b-92e1-5a89-ae49-b8409e585372/chat/get_pending_messages?licence_id=13480233&secured_session_id=&last_message_id=0 ’,
Iam trying to integrate with koreai getting the following error.I pinged koreai community they said the problem might be from Livechat.Can you please guide me on this.
Hi Shirisha!
The endpoint you’re calling supports 2 actions.
Requesting a list of visitors - a working curl for that here
Posting details of a visitor - I believe that’s what you’re trying to do here.
To add visitor details you need to use POST instead of GET,
there are also some problems with the URL itself, this part:
‘https://api.livechatinc.com/visitors/u-a7e5fd6b-92e1-5a89-ae49-b8409e585372 ’
looks accurate to the request format from our documentation,
the rest of the URL however I can’t really grasp.
An example of a working curl for that is available here
Full documentation of this endpoint can be found here
Long story short:
header ‘X-API-Version: 2’ is required
id is required (this can be any value but needs to be a string)
token is required (this token can be extracted from an ‘incoming_chat’ webhook
fields[0][name] and fields[0][value] are name and value of the custom variable you’re setting
I hope that helps!