Behavioral email is automated and targeted messages sent to customers based on their actions or behavior. By triggering on how your customers interact with your website or product, you’re able to send email whose content is actually aligned with what they’re doing, and will therefore be far more likely to resonate.

API companies are uniquely positioned to take advantage of behavioral emails; If monitoring and analytics is done right, then insights into what’s going on deep within the platform can be surfaced; And insightful, or even prescient, communiqués can be made.

Common capabilities of behavioral email in API platform companies include helping developers speed API integration & try out new product features, and keeping customers informed on subscription & platform issues.

Off-the-shelf behavioral email solutions can provide all of the functionality as outlined in this article. But in this post we’re going to break down what it would take, technically, to build your own behavioral email solution.

What’s required to build your own behavioral email solution?

A behavioral email product consists of at least three parts:

1. A methodology to get monitoring data from an API

2. A way to define rules and validate the monitoring data

3. A process to send specific emails to users when a rule is met

Acquisition of monitoring data from an API

Depending on how confident you feel, you could build a whole monitoring solution from scratch, or you could employ an off-the-shelf open-source system such as Prometheus.

Prometheus is a monitoring solution for microservices. By including a Prometheus client in your application, it can be called when you want to record a metric. The Prometheus server will then poll the data source at regular intervals and persist the result. The Prometheus docs have a setup guide to help with installation.

Prometheus clients come with default metrics configured out-of-the-box, so you don’t have to manually set up basic stuff like CPU or memory monitoring.

For a Node.js/Express.js based API, you can install the Node.js client for Prometheus via NPM and configuration only takes a few lines of code:


const prometheus = require('prom-client');

const register = new prometheus.Registry();

prometheus.collectDefaultMetrics({ register });

The default metrics are fundamental and not API related, so you would have to set up more complex metrics yourself.

The code for a very simple API metric might look like:


const activeRequests = new client.Gauge({

 name: 'activeRequests'

});

registry.registerMetric(activeRequests);

api.use((req, res, next) => {

 activeRequests.inc();

 res.on('close', () => activeRequests.dec());

 next();

});

Prometheus only covers three out of the top 15 most important API metrics you should be tracking, the rest have to be defined with custom code.

#api #email marketing #api integration #analytics platforms #api monitoring #monitoring and alerting #api providers #email api #email solution #user behavior analytics

Build vs. Buy Behavioral Email Platform for API Product Companies
1.10 GEEK