# Real-time Trigger Activation for Engage Studio

A Real-time 2.0 trigger can activate an Always-on Campaign in Engage Studio through a triggered activation in a real-time journey. Each trigger event sends one message to one recipient, using the content and sender of the campaign. This page explains how to create the authentication for triggers, how to write the payload of the triggered activation, what the trigger sends for each channel, and how to tell whether a send was accepted, rejected, or delivered. For the marketer's side of the setup, see [Real-time Triggered Campaigns](/products/marketing-cloud/engage-studio/real-time-triggered-campaigns).

## Prerequisites

Check these conditions before you turn on the trigger.

- **The campaign:** The Always-on Campaign is Live. A send to a campaign that isn't Live is rejected.
- **Real-time 2.0:** The Parent Segment has Real-time 2.0 set up. See [Real-time 2.0 Getting Started](/products/customer-data-platform/real-time/getting-started).
- **Authentication:** A Treasure Engage Streaming authentication, created as described in the next section.
- **Permission:** For email, the user associated with the key needs the `EngageEmailSender:view` permission for the workspace that owns the campaign's sender. Without it, sends are rejected and aren't retried.
- **Recipient data:** Each recipient has an email address, a device token for mobile push, or a LINE user ID, depending on the channel. A push send targets one device.
- **LINE:** The LINE Official Account that sends the message is set in the campaign.


## Create the authentication for triggers

Triggers use a Treasure Engage Streaming authentication. This authentication is separate from the Treasure Engage V1 authentication that journeys and batch activations use, so create a new one for triggers.

1. In Integrations Hub, select **Catalog**.
2. Search for **Treasure Engage Streaming**, and select the **Output** connector.
3. In the **New Authentication** dialog, enter your master API key after the `TD1` prefix, separated by a space. The format is `TD1 <YOUR_MASTER_API_KEY>`.
4. Select **Continue**, and complete the **Details** step.


![Integrations Hub catalog with Treasure Engage Streaming shown in the search results](/assets/real-time-trigger-catalog-treasure-engage-streaming.cc290eb7504c805d8641896a4d352bc24037f112fcba3924525f99431cd65816.5be018a0.webp)

![New Authentication dialog for Treasure Engage Streaming with the TD Master API Key field](/assets/real-time-trigger-new-authentication.8344453747eb7742548c38237c27e72c5c6c9bdac1a97240f88666ffc7ed0ddb.5be018a0.webp)

Note
A master API key has broad access to your Treasure AI account. Store it according to your organization's security policy, and limit who can select this authentication in a triggered activation.

## Configure the triggered activation

Add a triggered activation to a stage of a real-time journey. For the general steps, see [Creating a Real Time Triggered Activation](/products/customer-data-platform/journey-orchestration/realtime/creating-a-real-time-triggered-activation). For a triggered activation that sends to Engage Studio, set the following fields.

1. In **Triggered activation name**, enter a name, for example `Engage Trigger`.
2. In **Authentication**, select the Treasure Engage Streaming authentication that you created.
3. In **Campaign Type**, select the channel of the Always-on Campaign, for example **Email**.
4. In **Workspace ID**, enter the ID of the Workspace that contains the Always-on Campaign.
5. In **Always On Campaign ID**, enter the ID of the Always-on Campaign. The campaign must be Live.
6. In **Profile**, select **Add item**, and enter a key and a value for each item. Each key is read in the content as `profile.<key>`.
7. Set **Maximum Number Of Retry**, **Initial Retry Delay (in seconds)**, and **Retry delay multiple**. These settings control how many times the activation retries a failed send, and how long it waits before each retry.
8. Select **Create**, or **Update** when you edit an existing activation.


![Edit triggered activation dialog for Engage, showing Campaign Type, Workspace ID, Always On Campaign ID, Custom Event ID, Recipient, Profile, and retry settings](/assets/real-time-trigger-triggered-activation.75cb4646832d5d507a5544ef7c877b3ba7b6daaf3f4a57cba9eee48c84c7012e.5be018a0.webp)

The following example shows a profile with an imported attribute and a list attribute.

| Key | Value |
|  --- | --- |
| `email` | `{{imported.email}}` |
| `product_id` | `{{list.purchase_histories.last_product_ids}}` |


The `imported.` prefix refers to an imported attribute, and the `list.` prefix refers to a list attribute. For the full prefix notation, see [Using Real-time Attributes in Trigger Activations](/products/customer-data-platform/journey-orchestration/realtime/creating-a-real-time-triggered-activation#using-real-time-attributes-in-trigger-activations).

## What each trigger event sends

The recipient and the content come from the trigger event and the campaign. The sender isn't set in the trigger event.

| Channel | Recipient | Content | Sender |
|  --- | --- | --- | --- |
| Email | The email address of the recipient | The email content of the campaign | The sender profile of the campaign |
| Mobile Push | The device token of the recipient | The push content of the campaign | Not specified in the trigger event |
| LINE | The LINE user ID of the recipient | The LINE content of the campaign | The LINE Official Account set in the campaign |


## How profile values reach the message

Each key in the payload becomes a profile value. Engage Studio passes these values to the message, and the content reads them with Liquid tags such as `{{ profile.<key> }}`. In the example above, `product_id` is read as `{{ profile.product_id }}`. Use the same key names in the payload and in the content.

Currently, the send step doesn't read the customer profile again, so the values are the ones that the trigger event carried.

This differs from a batch campaign. In a batch campaign, each recipient is one row of segment data, and the output column mapping assigns each column to a key in the message. In a real-time triggered campaign, each trigger event is one payload for one recipient. For the marketer's view of this difference, see [How personalization differs from batch campaigns](/products/marketing-cloud/engage-studio/real-time-triggered-campaigns#how-personalization-differs-from-batch-campaigns).

Keep the following rules in mind when you design the payload.

- If the content uses a key that the event doesn't carry, the message can be rejected. Ask the marketer to add a `default` filter to any value that might be missing.


## Attribution keys

When the trigger event includes an activation ID and a journey ID, Engage Studio writes them into the profile as `activation_id` and `journey_id`. These keys overwrite any key with the same name in the profile, so don't use these names for your own values.

For email, the IDs are stored in the `activation_id` and `journey_id` columns of the [Email Delivery Events](/products/marketing-cloud/engage-studio/channels/email/email-delivery-events-table) table. These columns are stored as base32-encoded strings. To read them as text, decode them with the `from_base32()` and `from_utf8()` functions.

## How each send is handled

Each trigger event gets one of the following results. Only temporary failures are retried.

| Result | What it means | Retried |
|  --- | --- | --- |
| Accepted | The message is queued. This doesn't mean the customer received it. Check the delivery events for the result. | Not applicable |
| Rejected: the campaign isn't Live | The campaign is Draft, Paused, or Finished. | No |
| Rejected: the campaign isn't found | The campaign ID doesn't match a campaign in the Workspace. | No |
| Rejected: authentication or permission | The authentication isn't valid, or the user behind the key doesn't have the required permission. | No |
| Rejected: the message can't be rendered | The content uses a key that the event doesn't carry, or the profile values are not a key-value object. | No |
| Accepted, then the delivery fails | Engage Studio retries the delivery for up to 6 hours. If it still fails, the message moves to a dead-letter queue, and an alert is raised. | Yes, by Engage Studio (up to 6 hours) |
| Temporary failure | Engage Studio couldn't complete a request to a service that the send depends on. | Yes, by the connector |


Each send carries an idempotency key, which the Treasure Engage Streaming connector generates. If the connector sends the same send again, for example after a timeout, the message is still delivered once. Messages with the same key, channel, and recipient are treated as one send for 24 hours. Recipients are compared as written, so the same email address with different capitalization is treated as a different recipient.

To check whether a message was delivered, use the delivery events table for the channel. For email, see [Email Delivery Events](/products/marketing-cloud/engage-studio/channels/email/email-delivery-events-table). For mobile push, see [Push Events](/products/marketing-cloud/engage-studio/channels/mobile-push/push-events-table).

## Next steps

- [Real-time Triggered Campaigns](/products/marketing-cloud/engage-studio/real-time-triggered-campaigns) explains how to create and publish the campaign that the trigger activates.
- [Always-on Campaigns](/products/marketing-cloud/engage-studio/always-on-campaigns) explains the campaign statuses and what each status accepts.