How to perform agents concurrent conversation from Freshservice to Freshdesk

Hi Guys,

we are using the client.data.get(“loggedInUser”) , storing this in Freshdesk / Freshservice data storage and accessing the logged in userid in server less environment. but when there is parallel sessions by different users / agents, the client.data.get overrides the value. Due to this the actual agent who creates the conversation is not sent to Freshdesk / Freshservice. we are raising this issue to Devrels. We will need your guidance in resolving this issue.

Thankyou.

Hi, @Karuppu_Samy!

It was not clear to me where you are trying to store the logged agent.
Since you talked about conversation, I believe that is on Freshchat.
Either way, the advanced storage behaves the same in all products.
On the store method, you can specify some options.
In your use case, I believe you want to store the logged user just in the first time of determined event.
If it is the case, please refer to the code below:

client.db
      .set("ticket:101", { jiraIssueId: 15213 }, { setIf: "not_exist" })
      .done(function (data) {
        // success operation
        // "data" value is { "Created" : true }
      })
      .fail(function (error_data) {
        // failure operation
        console.log(error_data.status);
        console.log(error_data.message);
      });

From: https://developers.freshchat.com/v2/docs/data-storage/#store:

  • Set If (setIf) : The setIf attribute takes any one of the two values: exist or not_exist . The {setIf: “exist”} code stores the value if the key exists in the data store and throws an error if the key does not exist in the data store. Similarly, {setIf: “not_exist”} stores the value if the key does not exist in the data store and throws an error if it is an existing key.

If this is not the case, please, clarity your query.

2 Likes

Can you elaborate on what ‘value’ does being overwritten?

Sent from where?

If I understand this correctly,
App is running on Freshchat where multiple agents login and use the app. App captures ‘loggedInUser’ and stores it in Data Storage. But I assume in the process of storing… you see overwritten being happen.

We will need to know, ‘HOW’ are you storing your data as well so that we could better help.

The conversation creation is trigger in the server at the same time need to get the current agent of who has added the note in FS, because we want notify the mail id of the agent in the note.

This has been done for a agent create conversation synchronously, so we can able to get the mail id of the agent.
Suppose at a time perform multiple agents can create conversation asynchronously, we got the agent id of who has recently access the ticket page because overwriting existing agent details.

using SMI for to get the current agent and it has saved in localstore and we get agent details from localstore when the conversation creation is triggered in server.js.

How can i perform concurrent transaction.