Email notifications

FormFlow sends automated email notifications through SendGrid using dynamic templates. There are 4 message categories that you should create custom templates for:

  • SUCCESS

  • VALIDATION

  • ERROR

  • REJECTION

Each category can have its own SendGrid template with custom branding and styling.

In addition to a message_category, each message will also have a message_type, and you will want to handle different types of messages with in-template logic, as well as define a fallback condition to send a generic email in case you encounter a new type of email in the future.

Email Notification Types

Success emails

Positive confirmations as feedback to the user that all is going according to plan.

chevron-rightProcessing has begunhashtag

If an email is well received, we are able to pull all of its attachments, and all attachments are valid, then we reply to user to say that their submission is being processed.

Example Payload:

{
  "subject": "Your Submission is Being Processed",
  "message_category": "SUCCESS",
  "message_type": "submission_started",
  "submission_id": "ab761b6e-c9ba-41ef-9d08-b41c4e1de35b",
  "suggested_message": "Thank you for your submission. We have successfully received your documents and processing has begun. You will be notified once the process is complete.",
  "data": {}
}
chevron-rightSubmission completedhashtag

If email loopback functionality is enabled, and Ledger integration is configured, and the submission is completed, and it has been successfully exported to Ledger, we inform the user of this.

Example Payload:

{
  "subject": "Submission Processed Successfully",
  "message_category": "SUCCESS",
  "message_type": "submission_completed",
  "submission_id": "ab761b6e-c9ba-41ef-9d08-b41c4e1de35b",
  "suggested_message": "Your submission has been successfully processed and exported to our system. Thank you for using FormFlow.",
  "data": {}
}

Validation emails

Information requests – something about a submission is incomplete and requires the submitting user's attention.

chevron-rightMissing fieldshashtag

If email loopback functionality is enabled and an extraction is complete, but there are validation errors.

Example Payload:

Rejection emails

Active rejections: something about the submisison is unsatisfactory. It is likely that the user can do something about the situation.

chevron-rightUnsupported attachmentshashtag

If one or more attachments are not supported, then we advise the user that their submission will not be processed.

Example Payload:

chevron-rightWhitelist rejectionhashtag

If email whitelisting is configured, and the emailing user is not whitelisted by domain or email address, then we advise the user that their submission is not accepted.

Example Payload:

Error emails

Advisory email regarding processing failures. In these cases it is unlikely that the user can do something, and they should probably contact a support channel.

chevron-rightPre-processing errorhashtag

If there is an unexpected issue reading the incoming email, then we respond with a generic error message.

Example Payload:

chevron-rightProcessing errorhashtag

If there is an issue during processing, then we respond with an error message, detailing the submission ID, failure stage and a short error stack.

Example Payload:

chevron-rightExport errorhashtag

If Ledger integration is configured, but exporting a submission fails even after it passes validation, then we respond with a generic error message.

Example Payload:


Setting Up SendGrid Templates

FormFlow uses SendGrid's dynamic templates to send emails. Each template uses Handlebars syntax to dynamically insert data from the payload.

Template Structure

All email payloads follow a standardized, flattened structure for SendGrid:

Example: Validation Template Setup

1. Create the HTML Template in SendGrid:

2. Understanding Handlebars Syntax:

  • {{variable}} - Inserts the value of a variable

  • {{#if condition}}...{{/if}} - Conditional rendering

  • {{#each array}}...{{/each}} - Loop through array items

  • {{this}} - Current item in a loop

3. Key Template Variables:

All templates have access to these flattened variables:

  • {{subject}} - Email subject

  • {{message_category}} - Category (SUCCESS, VALIDATION, ERROR, REJECTION)

  • {{message_type}} - Specific message type

  • {{submission_id}} - Submission identifier

  • {{suggested_message}} - Main message content

  • {{data}} - Object containing category-specific fields

4. Category-Specific Data Fields:

Validation emails:

Error emails:

Rejection emails:

Success emails:

5. Configure in Organization Settings:

Inside FormFlow's settings tab editor you can assign the SendGrid template IDs to their respective message categories. Here you can see the templates object has truncated SendGrid template IDs, you should include yours in full.

6. Testing Your Template:

Use SendGrid's template editor test feature with this sample data:

Best Practices

  1. Always provide fallback content - Use {{#if}} blocks to handle missing data gracefully

  2. Keep inline styles - Email clients have limited CSS support

  3. Test across email clients - Use services like Litmus or Email on Acid

  4. Use semantic HTML - Tables for layout (email client compatibility)

  5. Optimize images - Host externally and use absolute URLs

  6. Keep file size small - Some email clients truncate large emails

Last updated

Was this helpful?