You are currently viewing Product engineering to build topic based chat conversation on top of freshworks

Product engineering to build topic based chat conversation on top of freshworks

1. Introduction

  • Fastcurve is an IT services and consultancy company trusted by global clients.
  • Detox, UK is a cybersecurity company excelling in providing cybersecurity services for enterprises.
  • Freshworks is a renowned organization providing above-par customer experience products via its SaaS product suite.

2. The Synergy

Detox envisioned a holistic digital security option for every user.

Detox partnered with Fastcurve to get the idea implemented and distributed via android and iOS apps.

Since the intent was to launch the MVP within a quick timeframe, Fastcurve aligned the overall project under the “Wings MVP Program” for accelerated delivery, where ideas are converted into a product in 8-16 weeks and are ready for adoption, growth, and investment.

Multiple features were part of the release though the most unique was “Cyber Guru”, which allowed users to start a topic-based chat. Users can ask their query or enquire about any doubtful email/SMS/call with cyber experts. This helps users resolve their anxiety in the quickest manner possible.

Freshworks was identified as the best service provider for SaaS-based messaging products and solving vast use cases.

3. Problem statement – Topic-based Chat

Detox requirement of the topic-based chat was integral to their solution. These chats needed to be persisted. Also, for better user experience, it was necessary to categorize queries into different states: Open, Answered, Closed.

If any chat is closed, there had to be an option to mark it again in an Open state. There was a need for a rich set of APIs from the service provider to achieve the outcome.

The feature had to be augmented with bot response and AI-based decision-making to reduce support operations eventually.

Topic-based Chat - Freshworks

Chat-fastcurve

4. Why Freshworks

Freshworks provides an incredibly simpler to implement and feature-rich option to integrate their SaaS offering to manage the chat.

Freshworks Messaging was serving most of the requirements out of the box and providing an intuitive agent dashboard. The overall product suite provided an option to extend use cases within the same ecosystem.

5. Current Freshworks Messaging service

Though Freshworks provides of box messaging service there was a need for product engineering to manage two important parts:

  • Making Chat conversation based.
  • Managing states of conversations.

Multiple meetings with the Freshworks team helped to identify ways to achieve these use cases. And the team eventually figured out the options.

In the pursuit, Freshworks product and support team were highly valued for professionalism, quick TAT, and eagerness to invest time for their customers’ success.

6. On the top – Fastcurve Product engineering

  • Making topic-based chat conversation:

Cyberguru has a requirement to have topic-based conversations. Multiple conversations can be initiated on different topic with the chat agent/expert panel at the same time. On the other hand, freshchat supports single chat per user. We created a hybrid model to support multiple topic-based chat support on the freshchat framework.

This is the freshchat code to set user details before initializing chat:

// Get the user object for the current installation
FreshchatUserfreshchatUser = Freshchat.getInstance(getApplicationContext()).getUser();
freshchatUser.setFirstName(“John”);
freshchatUser.setLastName(“Doe”);
freshchatUser.setEmail(“john.doe.1982@john.doe”);
freshchatUser.setPhone(“+91”, “4490987495”);

// Call setUser so that the user information is synced with Freshchat’s servers
Freshchat.getInstance(getApplicationContext()).setUser(freshchatUser);

Freshchat.getInstance(getApplicationContext()).identifyUser(externalId, restoreId);

It takes externalId and restoreId as parameters. For single chat, external id is set to the user’s email id but in our case, we set the external id as our topic identifier. We will explain in detail how to fetch topic identifier.

Restore id is fetched from freshchat while initializing chat in freshchat sdk. When user start the conversation in freshchat sdk, an event is raised with the restore id details which we can extract and save it in our database. This restore id is used when we restart the topic conversations to see the history of the conversations.

IntentFilterintentFilter = new IntentFilter(Freshchat.FRESHCHAT_USER_RESTORE_ID_GENERATED);
LocalBroadcastManager.getInstance(this.mContext.getApplicationContext()).registerReceiver(broadcastReceiver, intentFilter);

broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
saveFreshchatUserDetails(cyberguruTopicDTOTemp,
Freshchat.getInstance(context).getUser().getRestoreId(),
Freshchat.getInstance(context).getFreshchatUserId());
}
};

Now the next question is, from where we get the external id. As freshchat does not support multiple topic-based chat, we created the topic title in our database. The external id in this case is our database identifier for the particular topic.

The below sequence diagram will demonstrate in details the creation of topic and initialization of chat in freshchat.

So, this is the details of creating a conversation in detox shield app using freshchat sdk as chat system. Now the next big question is, how to retrieve the history of the chat on particular topic.

Freshchat keeps the history of the chat based on external id and restore id. We have saved both in our database and hence can be passed while initializing the chat in freshchat sdk. Freshchat sdk pulls the chat history based on external id and restore id. This completes the whole cycle of conversations in detox shield mobile application using freshchat sdk.

  • Managing states of conversations:

The other feature important feature of cyberguru module is to show the status of each conversation. Now we have three different statuses for each conversation – Open, Answered and Closed. On the other hand, freshchat has only two statuses for each conversation – Open and Closed.

So, we have open and closed status from freshchat API itself, next thing is to bifurcate between Open and Answered conversations. Freshchat messages API also contains details of the Actor of the message whether it is User or Agent. If the last message’s actor is Agent, we categorize it into Answered status, otherwise it is in Open category.

We use a combination of two APIs for each conversation to extract the exact status of the conversation. Both the APIs are highlighted in the below images:

If you look precisely the call when we saved the restoreId, we also save the freshchatUserId in our database.

broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
saveFreshchatUserDetails(cyberguruTopicDTOTemp,
Freshchat.getInstance(context).getUser().getRestoreId(),
Freshchat.getInstance(context).getFreshchatUserId());
}
};

The first API takes this freshchat userId as parameter. We pass the freshchatUserId saved with restoreId in the APIs and we get all the conversation list as response.

We call the next API which takes conversation id as parameter. We pass the conversation id fetched in first API call. This completes the whole cycle for fetching the conversation status.

7. Future possibilities

We are excited to launch the first version of the Cyber Guru in Detox app. The team is looking forward to implementing bot responses and use AI to learn the pattern of cyber issues raised by the user. These would serve a large scheme of plans of Detox and help end-users and the security ecosystem alike.

Contact us:

Contact for leveraging AWS cloud migration, infrastructure, analytics, machine learning, or Internet of Things (IoT) to build and orchestrate business solutions. Connect at:

Consultancy: https://calendly.com/fastcurve/meet

Quick Response Channel: https://wa.me/+918851500495

Leave a Reply