Twilio Flex’s ability to integrate with APIs has been one of Twilio’s strengths in the cloud contact center space. Their motto in my words is “If we do not have it today, we have the tools so you can build it yourself!” With their SendGrid acquisition I was super hopeful that there would be native email integration into the Flex platform but after years of hope and desire I decided to roll up my sleeves and do it myself.

The overall logic of how to handle email using Task Router and SendGrid is simple. And although other variations had been floating around, I wanted to implement it completely differently with new integration points and with different features to stress.

Components used to make email happen:

  • Twilio Flex
  • SendGrid
  • MongoDB
  • Personal Domain
  • NodeJS
  • REST API Server

Features I was able to implement are below:

  • New Case ID generation. This can be queried if there is an existing CRM.
  • Storing of messages in a database and displaying them for an agent.
  • Message ID, Mapping, and Threading of messages.
  • Emoji support
  • Customizing the Flex agent desktop
  • Auto-Generated signatures

Screenshots of the integration.

Figure 1. What an email looks like when it is presented to the agent.

Figure 1. What an email looks like when it is presented to the agent.

Figure 2. What an email looks like after it has been accepted.

Figure 2. What an email looks like after it has been accepted.

The nature of this project was more of a proof of concept to show what is possible with Twilio Flex and email. This can be implemented in many ways, including with an email server or with DynamoDB but my familiarity Mongo made that my go-to for this project. CRM integration with this solution could be fairly simple and could allow for screen pops, case references, or other details. There are also numerous considerations such as retention requirements that would alter components of this design to be tailored to the end user.

This was a great project and I expanded my knowledge of REST APIs, synchronous and asynchronous functions, emails, and reading documentation.