Keeping a log of messages sent and received via Front

Edited

Overview

A common requirement for many users of Front is to record a log of all messages send and received through Front in an external system. Here we’ll explore a couple of methods of achieving that functionality. 


Have your mail server save a copy of each email

One way to configure an email channel with Front is to have mail redirected from your mail server to your Front inbox (see Adding a Generic Inbox (via Email Forwarding): Activation Guide). When configuring your email channel in this way, many mail servers will offer the option for you to keep a copy of all inbound mail. This is what that option looks like when configuring redirection in Gmail:

In order to have your mail server retain a copy of all outbound mail, we would recommend you enable Custom SMTP for that channel, in order to have your mail server receive a copy of each outbound message, and be responsible for performing the sending. 


Using Rules and Webhooks

The Have your mail server save a copy of each email method works great for certain types of email channel, but what about everything else?

You can configure a rule to be triggered on any inbound, outbound or outbound reply message, for any channel type. You can then set any required rule conditions, and set the rule action to send to an integration like a webhook, Zapier, Parabola or Fivetran.

This will result in you receiving a notification in your chosen tool (or your own server/application if using webhooks) each time a message is sent or received in Front. These services allow you to build workflow automations to send logs of these messages to your data store, or other tools you integrate with.

This is likely the most efficient method of consuming this data, as it does not require you to poll Front’s API for data, and will deliver you a live feed of send and received messages.


Using the API

It is also possible to pull this information directly from Front’s API. Here we’ll list the appropriate API endpoints which could be used to keep a log of sent and received messages;

Events

The /events endpoint returns a feed of the most recent events to happen in your company Front account, including send and received messages. You can filter by specific event types to receive only the events that are important to you.

List conversations

The /conversations endpoint is used to list all conversations in your company in reverse chronological order (most recently updated first).

List conversations by inbox

The /inboxes/{inbox_id}/conversations endpoint lists conversations which appear in a specific inbox.

Conversation search

The /conversations/search/{query} endpoint can be used to issue specific conversation searches (similar to what you can perform in the Front application).

Analytics Export

Analytics Exports can be used to fetch lists of events (such as messages, archive, tag, assign, etc). This is helpful when working with a specific criteria for your filter, or large data sets.