This app is targeted for use in a customer-support contact center. I wanted to provide a seamless user experience for Agents using Appian as their case management system to participate in real-time chat with end users. The new web-content field in Appian 18.1 made this possible! I leverage Twilio Chat Apis to power the real time messaging and security.
What it does
In this app, and end-user initiates a chat by starting an Appian action. This action calls a process model that creates a private chat room for that end user along with the case. The support agents group will now have an Appian task available to join the room for that case. The first agent to accept the task joins the room and participates in the chat from within an Appian Task Form. When the chat is complete, the agents dispositions the task and data is available for reporting. When viewing the chat history, all messages are available to view, along with a sentiment analysis rating powered by Google Cloud API for Natural Language processing.
How I built it
The core of the chat functionality is built using Twilio Chat APIs. I built a lightweight Node.js Express app to provide a stateless container for the Chat UI - this is what gets embedded in the Appian Web Content field. The Appian Process Model that creates the case and chat channel uses Twilio APIs to create a unique and private channel for the case, and add the end user to be able to enter the channel. The channel UID is written to the Appian business database for future use. I use standard Appian Task assignment functionality for targeting the Agent group. The Process Model for the agent task calls Twilio APIs to join the agent user to the private channel. Twilio API calls are also used for writing system-generated chat messages when users join and leave the room. Chat history is built as an entity-backed Appian Record. Chat messages are retrieved in real-time again via Twilio-API with appropriate paging. Additionally, Google Cloud APIs are used in real time to process each message that the end user sent for sentiment analysis, and Appian Dynamic SAIL is used to display a visual indicator of that sentiment.
Challenges I ran into
Paging of results for message history was a challenge, especially since message data is stored on Twilio servers and not in the Appian database. Twilio's APIs support paging but the format of request data doesn't align perfectly with appian dataSubset. Additionally, since I'm displaying advanced UI using an Editable Grid, natural grid paging isn't available, so custom Appian paging controls needed to be built in SAIL.
Accomplishments that I'm proud of
I'm very happy with the security that's built in this app - being able to dynamically create the private chat channels and only add the appropriate users as they join. I'm also happy with being able to perform and display the sentiment analysis data in real time for data that is completely external to Appian. I think this is a great example of expanded dynamic UI that the web content field will enable for Appian going forward.
What I learned
There are definitely some pros and cons for keeping data such as message history on the external services. The way this system is currently implemented, there is no duplication of data, but the ability to aggregate and report on this data is limited.
What's next for Support Chat
Expansions of functionality for this app will include:
- Case classification to target subsets of agents
- Aggregation of sentiment data, such as average sentiment per user
- Non-Appian interface for initiating and participating in chat as end-user
- Real-time indication of sentiment