How to automatically tag conversations in Front using machine learning

Emily Hackeling, Content Marketing at Front
16 July 20217 Min Read

Tags in Front help you stay organized, easily identify important messages, and gather insights about your messages. Normally, teams add tags manually, or with automated rules in Front. Below, MonkeyLearn CEO Raúl Garreta explains how teams can use machine learning to bring another level of automation to tagging workflows in Front.

In these workflows, Front gathers and manages conversations with customers from various channels, like email, live chat, or SMS text. MonkeyLearn will apply machine learning: automatically tagging conversations based on the content of the conversation. Zapier will be the glue that sticks everything together.

Let’s do it!

Managing your messages in Front

Front allows your team to manage messages from every channel — email, group emails like team@, live chats, SMS texts, tweets and more — in a single inbox. Front has shared inboxes so you and your team can collaborate efficiently.

Benefits of Front
  • Centralize your communication channels into one place (e.g., email, texts, social and more).

  • Collaborate with your team behind-the-scenes (i.e., assign messages to each other, comment on messages).

  • Handle messages faster with powerful automations (e.g., set up rules to automatically assign, remind and respond to messages based on tags and keywords).

  • Generate performance analytics and integrate with the rest of your business apps.

Why are Tags and Rules so important in Front?

Tags are labels to help you keep track of conversations related to a given topic. Team Tags are visible to everyone on your Team, while Private Tags are only visible for your individual inbox. In Front Analytics, admins can create reports based on tags. You can click the "+tag" button at the top of the message to tag a conversation.

Rules save you time by automating repetitive processes. For example, you can create a rule to assign incoming messages to specific teammates, add tags to certain types of conversations, or always reply with a message templates. (Get more examples of automations you can build in Front in our Rules Directory.)

By combining tags and rules in Front you can automate many of your workflows. These rules can help you handle repetitive tasks to save time and increase your team’s efficiency:

  • Automatic routing to assign messages to your team members based on tags such as topic or issue type

  • Automatic prioritization to enrich incoming messages with additional context to help prioritize or triage based on tags such as urgency, sentiment or topic

  • Automatic responses to trigger auto responses based on tags such as intent, issue type, topic, urgency, and sentiment

  • Consistent analytics to build reports within Front or using external BI tools, with the aim to detect:

    • Trends on topics, regular bug reports, issues, requests, product aspects to improve, etc

    • How sentiment in your user base is evolving

    • Trending keywords and to discover potential new topics or features

Why automate tagging?

Tagging is important and has many benefits, but it takes time. If you automate it, your team can have more time to spend replying to messages. It also ensures that your tags stay consistent across all your messages as you grow.

Automating with MonkeyLearn

At MonkeyLearn we believe that manual repetitive tasks that involve text processing should be done by machines. By combining text classifiers and text extractors, MonkeyLearn can turn unstructured text data (such as emails, texts, and social media) into structured data, i.e., tags in Front. Those tags can then be used to automate your business workflows as described above. Picture each MonkeyLearn model (classifier or extractor) as a dedicated robot working just for you, handling the repetitive stuff while you focus on the strategic.

Benefits of MonkeyLearn
  • Save time by avoiding manual processing.

  • Ensure consistent tagging criteria without errors, real-time, 24/7.

  • Have a quick and consistent context on each conversation.

  • Make your team more efficient.

Steps to automatically tag conversations in Front using MonkeyLearn

So far this sounds beautiful, doesn’t it? Let’s jump right in and show you how to set it up.

Decide on the kinds of tags you want to assign to messages

To figure out how you want to tag messages, you can look at some of MonkeyLearn’s premade models (such as sentiment, urgency, keywords and more) or build your own custom models (where you define your own set of tags, and train a custom classifier or extractor to recognize them).

Connect MonkeyLearn to Front to tag every single message

One of the quickest ways to connect Front with MonkeyLearn is through Zapier, which will allow us to create a zap with the following steps:

Step 1 Set a Trigger for when a “New Inbound Message” comes into Front. Then connect your Front account to Zapier (admin access in Front is required).

Step 2 Add an Action from MonkeyLearn to Extract the relevant content from the message using the Email Cleaner model, this will remove last replies and email signatures. This is important because we will use the cleaned text for analysis in the next steps.

Step 3 Add any additional classifiers or extractors as desired. For example, you could add a Sentiment Analysis model (Classifier) to detect if the message has a positive, negative or neutral sentiment (useful to detect priority).

As you can see below, the text input will be both the message subject from step 1 and the cleaned message body from step 2:

Step 4 Add a topic classifier. As an example, you can check out the E-commerce support classifier that is a generic way of determining what a message is about. You can build a custom classifier with tags that apply to your unique business context as well. This is useful to automate routing based on topic and skills.

As you can see below, we selected a particular classifier by specifying a custom value for the classifier id.

Step 5 Finally, the last step is to add a Python code snippet to send the tags to Front through the Front API. Not a technical user? Not to worry, it’s easy to add, and you’ll be able to tell everyone you’re a hacker 😁

First, you have to add three inputs, and fill them with the following info:

  • convo_id, which is the id of the triggered Front conversation from step 1.

  • write_key, which is your API token from Front that will allow Zapier to communicate with the Front API (you can get your API token here).

  • tags, which are the tags predicted by the models in each of the previous steps.

If you have more than one model, just concatenate the results separated by a comma “,”.

Then, with the above filled out, you must copy the following Python code snippet in the Code field:

from datetime import date, datetime import json from requests import sessions

_session = sessions.Session()

class Serializer(json.JSONEncoder): def default(self, obj): if isinstance(obj, (date, datetime)): return obj.isoformat() return json.JSONEncoder.default(self, obj)

class APIError(Exception): def __init__(self, status, code, message): self.message = message self.status = status self.code = code

def __str__(self): msg = "[Error] {0}: {1} ({2})" return msg.format(self.code, self.message, self.status)

def patch(convo_id, tags, write_key): """Post the kwargs to the API"""

data = { 'tags': tags }url = '' + convo_iddata = json.dumps(data, cls=Serializer)headers = {'Content-type': 'application/json',"Accept": "application/json","Authorization": 'Bearer ' + write_key }res = _session.patch(url, data=data, headers=headers, timeout=15)

if res.status_code == 200 or res.status_code == 204: return "[Response]: OK"

try:payload = res.json()raise APIError(res.status_code, payload['code'], payload['message'])except: raise APIError(res.status_code, 'unknown', res.text)

res = patch(input_data['convo_id'],input_data['tags'].split(","),input_data['write_key'])

output = [{'res': res}]

When your zap is set up and running, this is what a Front message will look like. You will see the automatically populated tags on the top of every message. Cool!

Set up rules in Front to automate your workflows based on tags

These are some cool rules that you can set up in Front to trigger when tags are automatically populated:


Auto Responders

You can also get some cool analytics based on your tags that can help spot trends in your messages and conversations:

Automating with Front, MonkeyLearn, and Zapier

With the above, we have quickly created a way to automatically tag incoming messages in Front using machine learning. Based on these tags, you can trigger even more automations within Front, such as assigning conversations or replying with message templates. Feel free to add, edit, and experiment with more models and rules. Happy hacking!

This post was originally published on the MonkeyLearn Blog by MonkeyLearn CEO Raúl Garreta.

Want more inspiration for automating your team's workflows? Check out how Hostmaker, Fishbowl, Beyond Pricing, and Platzi are working faster by building on top of Front using our open API.

Written by Emily Hackeling
Originally Published: 31 August 2018
Team productivity

5 ways to build a collaborative team that aren’t tech tools

Collaboration can be transformative. When your team works together, “I did it,” becomes “We did it!”

Read more
Team productivity

5 easy team building games and activities to bring remote teams together

Remote work means trying twice as hard to get the team to interact. But cheesy icebreakers on Zoom aren't the only option.

Read more

Get the latest stories, videos, and more.