How to find a chat got expired because of threading enabled?

Hi, we are developing an application for your market place using Freshchat.

In freshchat if a user enables threading and the conversation gets expired. If we try to check the conversation info using the API /v2/conversations/{conversation_id}, we don’t see anything that says the conversation was resolved and expired because of threading.

We were able to identify it only when we send a message to that conversation. When we send a message to a conversation using the API POST /conversations/{conversation_id}/messages
which got expired because of threading, we get this response

response: ‘{“code”:400,“status”:“BAD_REQUEST”,“message”:“Conversation ID 123-456-789-CONVERSATION-ID passed is not the latest conversation for this topic.”}’.

Is there any other way to find whether the conversation is expired other than this.

Kindly help us @zach_jones_noel @Raviraj @Saif

@Freddy Kindly provide your solution for this.

Hello Gopi,

I understand that you’re looking for an alternative solution to find out whether a conversation has expired in Freshchat due to threading enabled, without sending a message to it.

Based on Freshchat’s API documentation, there isn’t a direct way to determine if a conversation is expired or resolved solely by fetching the conversation information. However, I suggest a possible workaround to minimize sending messages to potentially expired conversations:

  1. Fetch conversation details with /v2/conversations/{conversation_id}.
  2. Look for the “last_updated_time” field in the response. It contains the timestamp of the last update made to the conversation.
  3. Compare this timestamp with the duration set for conversation expiration in Freshchat settings (if it’s fixed and known beforehand).
  4. If the time difference exceeds the expiration duration, you can assume the conversation is likely expired.

Please note that this workaround might not be 100% accurate as it’s based on assumptions, but it could help minimize the interactions with expired conversations. It’s always good to consult with Freshchat support for more information or possible upcoming features related to this issue.

@Freddy can we use conversation update to listen whether it is closed or not

Hello Gopi,

Yes, you can use the “conversation update” webhook event in Freshchat to listen for changes in conversations, which includes whether a conversation is closed or not. Here’s how you can set it up:

  1. Go to your Freshchat dashboard and navigate to the “Settings” section.
  2. In the “Settings” section, click on the “Webhooks” tab.
  3. Click “Add Webhook” to create a new webhook event listener.
  4. Now, you need to provide a webhook URL from your application. This URL will receive updates whenever there’s a change in the conversation status.
  5. In the “Event” dropdown, select the “conversation update” event option.
  6. Once the webhook is set up, your specified URL will receive notifications whenever a conversation’s status changes, including when it’s closed or resolved.

You can then process these notifications in your application to check if the conversation is closed or not, without having to send messages to the conversation. For more information on handling webhook events with Freshchat, I recommend consulting their API documentation: https://developers.freshcaller.com/docs/webhooks/

Keep in mind that you might want to perform validation and handle errors for incoming webhook events in your application to ensure data consistency and security.