---
title: "Adding a TMID to Messages"
slug: "add-a-tmid-to-messages"
updated: 2025-05-26T14:10:37Z
published: 2025-05-26T14:10:37Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding a TMID to Messages

## Goal​

To enable individual tracking of message delivery and engagement, add a unique Transactional Message ID (TMID) to every message in a group.

## Background Information​

A TMID is a unique identifier assigned to each transactional message. It allows precise tracking to verify if a contact received and opened a message. This is especially useful when tracking interactions across systems.

- TMIDs are generated using a pattern defined in the group settings.
- The pattern must generate a unique ID for every message. Otherwise, you cannot track the messages individually.
- TMID data can be exported using *Raw Data Export* for use in external systems.
- This procedure is not required if you send transactional messages via the Mapp Engage API and your external system has already assigned unique IDs. For details, see: [Send Transactional Messages (API)](/v1/docs/send-transactional-messages-api).

## Procedure

1. In the main navigation, click *Audience* > ​*Group Management*​ *> Groups.*
2. Open the selected group and navigate to the **Sendout Options** tab.
3. Expand the ​**Transactional Messages** section.
4. From the ​**Transactional Mode**​ drop-down, choose the desired setting:
  - **On**: Mapp Engage generates a TMID based on your defined pattern. It overwrites any external IDs.
  - **Optional**: Allows you to use external TMIDs if provided. If no TMID is included in the sendout, Mapp Engage automatically generates one based on the defined pattern.
5. In the **Pattern for the TMID** field, enter a pattern that creates a unique ID for each message. To include attributes, click *Personalisation*.
6. Click **Save**.

> [!NOTE]
> **Note**: If a transactional message is sent to a contact who is not already in the group, Mapp Engage automatically adds the contact to the group.

### Example Pattern

This expression creates a TMID using the user ID, message ID, and a UTC timestamp:

```pgsql
=<%${user['PK']}%>m=<%${message['PK']}%>t=<%${ecx:formatDate(ecm:addInterval(date.today, '-0d'),'yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\'', ecm:timeZone('UTC'),'', false)}%>
```

- `u=&lt;%${user['PK']}%&gt;`
  - Adds the **user’s primary key (user ID)** to the TMID.
- `m=&lt;%${message['PK']}%&gt;`
  - Adds the **message’s primary key (message ID)** to the TMID.
- `t=&lt;%${ecx:formatDate(...)%&gt;`
  - Appends a **timestamp** in UTC format:
    - `date.today` sets the current date.
    - `ecm:addInterval(..., '-0d')` keeps the date unchanged but is available for modification if needed.
    - `'yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\''` formats the timestamp in ISO 8601.
    - `ecm:timeZone('UTC')` ensures the time is recorded in Coordinated Universal Time.

This combination guarantees that each TMID is unique for every user-message pair and sendout time.

## Related

- [Group Creation: Sendout Options](/sendout-options-tab.md)
