Application Channel Message Templates

Application channels support message templates that are synced from the external services they connect to. You sync the templates using the Channel API. While the templates are originally created in the external service, they can include variables that get replaced with dynamic values from Front when sent.


For example, you can sync WhatsApp message templates as application channel templates in Front, making them available for any WhatsApp application channel you've created.

To allow message templates for your application channel, go to your developer app, find the application channel feature, and enable the Templates checkbox in your application channel settings.


Template structure

Templates are configured in the external service (such as WhatsApp, Facebook, Google, etc.) and their static content and variables are brought into Front through the Channel API.

Variables

Variables render within double curly braces. For example:

Hello {{1}}

The variable {{1}} is a placeholder that will be replaced with a value when the template is sent (e.g., the recipient’s name).

Channel API

Refer to the following reference topic to see how application message templates are represented in the Channel API:

Application Message Templates

Create an application message template

To create a new template, use the Sync application message template endpoint to send the following request:

PUT /channels/<front_channel_id>/application_message_templates

If successful, this adds the application message template to Front.

📘

Make sure you enabled Templates in your application channel settings within your developer app

Updating an application message template

After you've imported an application message template for the first time, use the Update application message template endpoint to sync updates to the template.

Configuring application message templates in Front

Once synced through the Channel API, admins can view templates in the channel’s configuration page (Settings -> workspace/company/personal -> Channels -> channel), under the Templates tab:


Admins should click on a template to configure its variables by:

  • Mapping each variable to a Front conversation property (recipient name, email, conversation ID, etc.)
  • Defining a default value.

Sending application message templates

Front teammates can select templates directly in the composer by clicking the corresponding application icon when viewing a conversation in the channel. They’ll see a searchable list of templates (name + blurb). Hovering over one shows a preview.

After selecting a template, teammates can confirm or edit variable values.


Sent application message template payloads

When teammates click the Send button for a template, Front sends the payload described in this section.


Front automatically fills variables using either:

  • The mapped context variable (e.g., sender email) or user-supplied value
  • The default value, if it exists and the mapped values do not exist.
  • A blank input, if no value can be resolved.

When the template is sent, the message payload looks like:

{
  "type": "message_template",
  "payload": {
    "_links": {
      "self": "https://front.local/messages/msg_7",
      "related": {
        "conversation": "https://front.local/conversations/cnv_6",
        "message_seen": "https://front.local/messages/msg_7/seen"
      }
    },
    "id": "msg_7",
    "message_uid": "eebaf9631c8ab16f",
    "type": "custom",
    "is_inbound": false,
    "created_at": 1757340570.007,
    "body": "Hello there",
    "is_draft": true,
    "application_message_template": {
      "id": "template6",
      "variables": [
        { "uid": "uid1", "type": "text", "value": "value" },
        { "uid": "uid2", "type": "text", "value": "value" }
      ]
    }
  },
  "metadata": {
    "external_conversation_id": "app-message-template-ext-conv-id",
    "external_conversation_ids": ["app-message-template-ext-conv-id"]
  }
}

Key differences from a regular message:

  • type = "message_template"
  • application_message_template contains the template ID and resolved variables.

Example resolved variables

"variables": [
  { "uid": "HEADER_1", "type": "text", "value": "David Lynch" },
  { "uid": "BODY_1", "type": "text", "value": "[email protected]" },
  { "uid": "BODY_2", "type": "text", "value": "YES" },
  { "uid": "BODY_3", "type": "text", "value": "NO" }
]

Advanced configuration

Automatically import templates during channel creation

Some channels may contain hundreds or thousands of templates. To handle large imports during channel creation, Front sends a special event:

{
  "type": "message_template_fetch",
  "payload": {
    "channel_id": "ch_1i2euy",
    "page_token": null,
    "limit": 100
  }
}

Where:

  • page_token indicates which page Front is requesting (starts as null = page 0).
  • limit is the number of templates per page.

Your response must be structured as:

{
  "type": "message_template_fetch",
  "templates": [ Template ],
  "pagination": {
    "next_page_token": "token123"
  }
}

Where:

  • templates: list of templates that conform to the template structure ADD LINK
  • pagination.next_page_token: optional, indicates another page is available.

If a next_page_token is returned, Front will request the next batch until you return an empty token.

Media Type Variables

Variables can hold media attachments (e.g., images, videos, PDFs). When a user uploads a file, it gets uploaded as a Front message attachment:

In the sent template payload, the variable references the attachment:

{
  "type": "message_template",
  "payload": {
    "id": "msg_7",
    "attachments": [
      {
        "id": "fil_1",
        "url": "https://front.local/messages/msg_7/download/fil_1",
        "filename": "attachment_name",
        "content_type": "image/png",
        "size": 29,
        "metadata": { "is_inline": false }
      }
    ],
    "application_message_template": {
      "id": "template8",
      "variables": [
        {
          "uid": "uid1",
          "type": "file",
          "value": {
            "id": "fil_1",
            "url": "https://front.local/messages/msg_7/download/fil_1",
            "filename": "attachment_name",
            "content_type": "image/png",
            "size": 29,
            "metadata": { "is_inline": false }
          }
        },
        { "uid": "uid2", "type": "text", "value": "value" },
        { "uid": "uid3", "type": "text", "value": "value" }
      ]
    }
  }
}

The media variable includes a reference to the uploaded file (via url), which can be fetched like any regular attachment. The same structure applies to images, videos, and files.