Skip to Content

Automated Follow-Up Emails

In this workflow, a CRM application automatically sends follow-up emails after a customer interaction. For example, when a sales rep logs an interaction with a prospect, the system will automatically schedule a follow-up email to nurture the lead. This increases engagement and ensures no prospect is left unattended. Connectifi’s FDC3-enabled integration lets you capture context events (e.g., new interactions) and then trigger actions (sending a follow-up email via your mailing service) seamlessly. This concept builds on standard CRM practices.


Sequence Diagram


Implementation Patterns & Code

Below are code examples using TypeScript that illustrate key parts of this workflow.

1. CRM Application using Agent SDK to Broadcast Customer Interaction

import { DesktopAgent } from '@finos/fdc3'; import { createAgent } from 'https://platform.connectifi.app/agent/main.bundle.js'; const agent: DesktopAgent = await createAgent('https://platform.connectifi.app', 'CRM_APP@DIRECTORY'); // Listen for new customer interaction context events (could be triggered after an interaction is logged) agent.addContextListener('fdc3.crm.interaction', (context) => { console.log('Received CRM Interaction:', context); }); // Function to broadcast a customer follow-up context after interaction const broadcastFollowUp = async () => { const interactionContext = { type: 'fdc3.crm.interaction', data: { interactionId: 'INT-1001', customerEmail: 'customer@example.com', interactionSummary: 'Discussed product features', followUpDue: '2023-11-15T10:00:00Z' } }; // Broadcast the initial interaction context await agent.broadcast(interactionContext); }; // Trigger broadcast (this could be tied to a UI action) broadcastFollowUp();

2. Delivery Hook for Enriching Context with Email Follow-Up Details

import { DeliveryHookHandler } from '@connectifi/sdk'; import { Context, ContextTypes } from '@finos/fdc3'; import { RequestError } from '../types'; export const emailEnrichmentHook: DeliveryHookHandler = async (request) => { const { context } = request; if (context.type !== 'fdc3.crm.interaction') { throw new RequestError('Unsupported context type'); } // Enrich context: add email subject and body template details const enrichedContext: Context = { ...context, emailSubject: `Thank you for your interest!`, emailBody: `Hi there,\n\nThank you for your recent interaction with us. We look forward to assisting you further.\n\nBest regards,\nSales Team` }; return { context: enrichedContext }; };

3. Outbound Action Handler for Sending the Follow-Up Email

import type { DataActionHandler } from '@connectifi/sdk'; import type { Context } from '@finos/fdc3'; const SERVICE_API_KEY = process.env.SERVICE_API_KEY; export const sendFollowUpEmailHandler: DataActionHandler = async (request) => { const { context, intent } = request; if (!SERVICE_API_KEY) { throw new Error('Service API key is missing'); } if (intent !== 'SendFollowUpEmail') { throw new Error('Intent not supported'); } // Call the external Email Service API to send the email const response = await fetch('https://email.api.service/send', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${SERVICE_API_KEY}` }, body: JSON.stringify({ to: context.data.customerEmail, subject: context.emailSubject, body: context.emailBody }) }); if (!response.ok) { throw new Error('Failed to send follow-up email'); } const result = await response.json(); return result; };

4. Example of a Receptor that Receives Notification of the Email Outcome

import { createReceptorAgent } from '@connectifi/sdk'; import { Context } from '@finos/fdc3'; const sendEmailAlert = async (emailStatus: Context) => { const interopHost = '<YOUR_HOST_HERE>'; const token = '<YOUR_API_JWT_HERE>'; const from = '<YOUR_USER_EMAIL_HERE>'; const agent = createReceptorAgent({ interopHost }); const alertData = { channel: 'connectifiAlerts', context: { type: 'connect.email.notification', status: emailStatus, source: 'Email Service' } }; agent.broadcast(token, from, alertData); };

Connectifi Platform Configuration

  1. Create or update a directory entry for the CRM application in the Connectifi Admin UI.
  2. Register the Delivery Hook “emailEnrichmentHook” to intercept and enhance “fdc3.crm.interaction” contexts.
  3. Configure an Action with the intent “SendFollowUpEmail” that uses the outbound handler (sendFollowUpEmailHandler).
  4. Set up the corresponding Receptor that listens for notifications on the “connectifiAlerts” channel for email confirmations.

Next Steps

  • Embed the Agent SDK into your CRM web application to start capturing interactions and broadcasting contexts.
  • Test your Delivery Hook by simulating CRM interaction events and verifying enriched contexts.
  • Deploy the outbound Action Handler to your service hosting environment with correct API keys.
  • Monitor email notifications through the Receptor to ensure follow-up emails are sent successfully.
  • For further details on FDC3 integration with Connectifi, check out the Connectifi documentation and explore more open source projects.

This workflow ties together context propagation, enrichment, and outbound messaging to automate follow-up emails in a CRM setting using proven Connectifi and FDC3 patterns.

Last updated on