How to determine if conversation is from Agent or Customer

I can get conversations from Freshdesk tickets using List All Conversations of a Ticket but want to determine if the conversation entry was created by the Agent or customer?

I know the agent/customer ID is included with each conversation entry and I could do a lookup to see if this is an agent but can I be sure that agent IDs and customer IDs will never be the same?

1 Like

As far as my understanding is, you can’t differentiate between agents and user IDs in a conversation object, though this sounds like a good feature if we can get it in the payload.

hey @RobAtOpinyin

with the user_id, you get from the conversation, you can either make a get request to view an agent or view a contact from the response status code you can figure it out.

although this is a hack, let me also check if there is another way

Stay safe :slight_smile:

3 Likes

Thanks Yusra. That’s where I got to as well so had to consider the extra API calls.

I agree. It would be good to have a little extra data in the payload to indicate if its an agent or customer. More detail on the source would be good as well ie. is it from an email, the portal, integration like Freshchat, etc.

1 Like

Thanks for the tip Velmurugan.

Main concern with the hack is it would be a lot of API calls and would probably cause rate limit issues. Do you know if the agent ID and user ID are unique i.e. an agent won’t have the same ID as a customer?

@yusrakhatri @RobAtOpinyin

Can you try checking for the key incoming in the response payload?
Typically email replies/notes will have the key incoming: true or incoming: false in the response of the Rest API as shown below.

image

So you should be able to determine if the response is of an end-user or an agent.

Let me know if this works for you.

2 Likes

Thanks Arjun. The API docs say that this only indicates if the response is from outside of Freshdesk so won’t identify if its a customer reply on the portal.

@RobAtOpinyin The parameter will be true for all customer replies including public notes that are added from the end-user portal.

Using a combination of this and the from_email key from the payload we should be able to differentiate between notes, replies of end-users and agents. Although not a fool proof solution it should help for the time being.

3 Likes

Thanks Arjun. Solution much appreciated.

1 Like