Error sending message to LiveChat

When the user messages the agent via API after few hours(less than 8 hrs.), then the chat would have been archived, so the message is not sent. For this reason, I make an API call to active the chat back (by passing “chatId”), but I receive an error for re-activating the chat.

Ultimately, I need to create a new chat, which might not be the feasible solution as the same user tries to connect again and the old transcript is lost.

Hello!

Please make sure that your backend application refreshes the customer’s token after 8 hours from initially creating it. To achieve that, your app can facilitate the customer authorization flow that is described here:


To refresh the access token for already existing customer, all that you have to do is to follow the steps in this documentation just as you would create a new customer, but this time the application should send request with the additional entity_id parameter. By doing that, you will make sure that already existing customer will receive a new access_token and with the use of it, you should not have any problems with reactivating the chat for already existing customer.

Here is an example of that request:
{ "client_id": "9cbf3a968289727cb3cdfe83ab1d9836", "response_type": "token", "redirect_uri": "https://my-application.com", "entity_id": "bf18d1a8-1afe-4a3e-4cc0-a3148f1143db" }

Let me know if that helps!