---
title: Use Optimizely Triggered Messages with Optimizely Campaign
slug: product-recommendations/docs/use-optimizely-triggered-messages-with-optimizely-campaign
docTags: 
createdAt: 2026-07-30T20:41:30.719Z
---

This topic describes how to connect Optimizely Triggered Messages to Optimizely Campaign.

:::hint{type="info"}
**Note**

To use Triggered Messages with Optimizely Campaign, your system administrator or developer must configure tracking first. When tracking is configured, you can continue to set up Triggered Messages following the steps described here.
:::

## Send triggered emails

You need to create a mailing campaign in Optimizely Campaign and campaigns in Triggered Messages and Email Product Recommendations. In Triggered Messages, you must also connect to your recipient list in Optimizely Campaign and specify the appropriate action to take.

The following image shows the flow through Triggered Messages and Optimizely Campaign when users abandon their basket, triggering an email to be sent to them directly.

![Image: Triggers-to-Campaign flow chart](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/Pen8MibAfJhlCfQtg6ggK-20260720-150236.png "Image: Triggers-to-Campaign flow chart")

To set up the Triggered Messages-to-Campaign integration, do the following.

- **Optimizely Recommendations Portal** > **Triggers**, set up the following:
  - **ESP connection** to connect to the Optimizely Campaign HTTP API. Enter the **Recipient list authorization code**, which is a token giving authorization access to a particular recipient list. See [Retrieve the Recipient list authorization code](docId\:Z6kezD953z6_m-SsL8Ox-), and also [Set up an ESP connection](docId\:UqO0jXgxuqhLxQta4NEC-).
  - **ESP action** to set up one of the following actions:
    - **Send Message to user** – Specify a **Mailing ID** for the email template in Optimizely Campaign. The previous chart shows this action being used. See [Create a Send message to user action](docId\:Z6kezD953z6_m-SsL8Ox-) and also [Set up an ESP action](docId\:UqO0jXgxuqhLxQta4NEC-).
    - **Add user to target group** – Specify a **User property name** and a **User property value**. See [Create an Add user to target group action](docId\:Z6kezD953z6_m-SsL8Ox-).
    - **Remove user from target group** – Specify a **User property name**. See [Create a Remove user from target group action](docId\:Z6kezD953z6_m-SsL8Ox-).
  - [Set up an Optimizely Triggered Messages campaign](docId\:UqO0jXgxuqhLxQta4NEC-) with a specific strategy, such as **Abandoned basket**.
- In **Optimizely Campaign**, you need the following:
  - A **Recipient list**.

    :::hint{type="info"}
    **Note**

    Triggered Messages can only send emails to existing users in the recipient list for compliance reasons.

    To add users to the recipient list and make them available for Triggered Messages, you can use a Campaign API. See [Optimizely Campaign's APIs and libraries](https://world.optimizely.com/documentation/class-libraries/campaign/).

    See the [legal requirements](docId\:b-9qHyH-hwaHqSn_n5zHd) regarding the advertising consent of the recipients.
    :::
  - A **Transactional mail campaign**.
  - Set up an associated transactional mail campaign in Optimizely Campaign by [copying the generated HTML code](docId\:Z6kezD953z6_m-SsL8Ox-) from Email Product Recommendations and pasting it into the email template (with that **Mailing ID**) on the Optimizely Campaign portal. The HTML code contains placeholders that the ESP (Optimizely Campaign) replaces with the actual values for each email sent.

When an Optimizely trigger fires, using the Optimizely Campaign HTTP API, Triggered Messages sends Optimizely Campaign the following for a **Send Message** action:

- **Recipient list authorization code** – A Recipient list authorization code creates a connection between Optimizely Campaign and the Recommendations Portal, and adds the **triggerFireId** to a user's entry in the recipient list.
- **Mailing ID** – For **Send Message**, for that **Mailing ID**, Optimizely Campaign replaces the placeholders in the Email Product Recommendations template HTML code with the values sent in the API request.
  - **triggerFireId** – Replaced with the ID of the Triggered Messages campaign sent in the API request.
  - Either of the following:
    - **recipientid** – Replaced with the user's email address sent in the API request.
    - **bmThirdPartyId** – Replaced with the user's email address mapped from their pseudonymized user ID.

## [use-optimizely-triggered-messages-with-optimizely-campaign.mdx](docId\:Z6kezD953z6_m-SsL8Ox-)Retrieve the Recipient list authorization code

To retrieve the Recipient list authorization code:

1. Open the Optimizely Campaign menu and select **Administration&#x20;**>**&#x20;API Overview** in Optimizely Campaign.
2. Select **Recipient lists** to show its table.
3. Select your recipient list from the table.
4. Click **Manage authorization codes**.

   ![Image: Manage Authorization Codes button](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/Pe_7VRx3otkDAOQj1mrY_-20260720-150236.png "Image: Manage Authorization Codes button")
5. From the **Manage Authorization Codes** view, copy the authorization code.

   ![Image: Manage Authorization Codes screen](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/pQNdpNu0t2S_Omco4QkCw-20260720-150236.png "Image: Manage Authorization Codes screen")
6. Paste the authorization code into the Recommendations Portal on the **Triggered Messages >\*\*\*\* ESP connections** page.

   ![Triggers4-a.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/ypeWfpudgezkx8F5MoAnp-20260720-150236.png)
7. Enter the connection name.
8. Select **Episerver Campaign** as the name of your ESP.
9. Click **Test ESP connection**.
10. If the connection was successful, click **Save ESP connection**.

## Link to a specific basket

Optimizely can integrate links from an email recommendation to a particular recipient basket. To enable this feature, contact customer service.

For developer information, see [Link to a specific basket](https://world.optimizely.com/documentation/developer-guides/personalization/integration-guides/server-to-server-api/link-to-a-specific-basket/) on Optimizely World.

## [use-optimizely-triggered-messages-with-optimizely-campaign.mdx](docId\:Z6kezD953z6_m-SsL8Ox-)Create an ESP action

See also [Set up an ESP action](docId\:UqO0jXgxuqhLxQta4NEC-).

### [use-optimizely-triggered-messages-with-optimizely-campaign.mdx](docId\:Z6kezD953z6_m-SsL8Ox-)Create a Send message action

To send messages using Triggered Messages directly to users, you need to provide the **Mailing ID** of the Optimizely Campaign campaign on the Triggered Messages ESP action page. You can retrieve the **Mailing ID** by following these steps:

1. Open the Optimizely Campaign menu and select **Campaigns&#x20;**>**&#x20;Transactional\*\*\*\*Mails** in Optimizely Campaign.
2. Copy the **Mailing ID** for your campaign from the ID column.

   ![Image: Copy Mailing ID for your campaign from the ID column](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/zwSCUKLv7TGAcNDrTGdJy-20260720-150236.png "Image: Copy Mailing ID for your campaign from the ID column")
3. In the Recommendations Portal, go to **Configuration > Triggered Messages&#x20;**>**&#x20;ESP actions > selected action** and paste the **Mailing ID**.

   ![Triggers12-a.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/YDSppujrwG6ex_2USoMLC-20260720-150236.png)

   1. **ESP action name**. Enter the action name.
   2. **ESP connection**. Select the connection that you created earlier.
   3. **ESP action type**. Select **Send message to user**.
   4. **Mailing ID**. Enter the campaign Mailing ID.
   5. **Test ESP action**. Enter the email address of the email recipient and click **Test ESP action**.
4. If the test is successful, click **Save ESP action**.

### [use-optimizely-triggered-messages-with-optimizely-campaign.mdx](docId\:Z6kezD953z6_m-SsL8Ox-)Create an Add user to group action

1. Go to **Configuration** > **Triggered Messages** > **ESP actions** > selected action in the Recommendations Portal.

   ![Triggers9-b.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/P_Yf7LV4GiOxybZ1LOZrU-20260720-150236.png)

   1. **ESP action name** – Enter the action name.
   2. **ESP action type** – Select **Add user to group**.
   3. **ESP connection** – Select the connection that you created earlier.
   4. **Group ID** – Enter the group identifier.
   5. **Test ESP action** – Enter the user's email address and click **Test ESP action**.
2. If the test is successful, click **Save ESP action**.

### [use-optimizely-triggered-messages-with-optimizely-campaign.mdx](docId\:Z6kezD953z6_m-SsL8Ox-)Create a Remove user from group action

1. Go to **Triggers&#x20;**>**&#x20;New campaign&#x20;**>**&#x20;ESP actions** page in the Recommendations Portal.

   ![Triggers10-b.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/LseIZP6yczM9ymgILRTY7-20260720-150236.png)

   1. **ESP action name** – Enter the action name.
   2. **ESP action type** – Select **Remove user from group**.
   3. **ESP connection** – Select the connection that you created earlier.
   4. **Group ID** – Enter the group identifier.
   5. **Test ESP action** – Enter the user's email address and click Test ESP action.
2. If the test is successful, click **Save ESP action**.

## [use-optimizely-triggered-messages-with-optimizely-campaign.mdx](docId\:Z6kezD953z6_m-SsL8Ox-)Set up an email campaign in Optimizely

The following procedure shows how to generate HTML code to copy from Optimizely Email Product Recommendations into a mailing in the Optimizely portal.

1. In the Recommendations Portal, go to Email Product Recommendations >**&#x20;Campaigns**.
2. Select and open your Email Product Recommendations campaign.
3. In the **Configuration** tab, choose a trigger strategy.
4. Go to the **HTML and preview** tab.
5. Select **Optimizely Campaign** as the **Email service provider**.
6. Click **Generate code**.
7. Copy the HTML code displayed in the window.

   ![Image: Example of generated HTML code](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/1r_3K7ctQnhK6zQk8C4Uq-20260720-150236.png "Image: Example of generated HTML code")
8. Go to Optimizely Campaign.

   :::hint{type="info"}
   **Note**

   To create a mailing in Optimizely Campaign, go to **Campaigns&#x20;**>**&#x20;Transactional mails** and follow the instructions in [Transactional messages](docId:6JbMqxBf1Te6K0YPlNSxo).
   :::
9. Open the Optimizely Campaign menu and select **Campaigns** > **Transactional Mails**.
10. Select your email campaign.
11. Click **Edit**.
12. In the **Edit transactional mail** window that opens, click the email node and click **Edit**

    ![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/eoy8le_QSgTktlMlAXoUa-20260720-150236.png)

:::Paragraph{indent="1"}
.
:::

13. Click **Edit content**.
14. Add or find the **Source Code** paragraph in the editor where you want to insert the Optimizely recommendations. A separate **Text/Image paragraph** was added above for the heading *Recommendation Paragraph in the image below*.
15. Click the **HTML** tab.
16. In the **Source code** field, paste the HTML code (copied in step 6):

    :::hint{type="info"}
    **Note**

    You can modify the HTML to add the default image size sent for empty images with no products. If you do not change the HTML, the default for width and height is 1px for empty images with no products. For example: 

    ```javascript
    <a href="https://abcde.optimizely.net/link.page?e={bmThirdParty}&site=clientsite&wid=12345&rno="0"><img src="https://abcde.optimizely.net/image.page?widthIfEmpty=100&heightIfEmpty=200&e={bmThirdPartyID}&site=clientsite&wid=12345&rno=0" alt="Just for you" title="Just for you" /></a><a href="https://abcde.optimizely.net/link.page?e={bmThirdParty}&site=clientsite&wid=12345&rno="0"><img src="https://abcde.optimizely.net/productinfo.page?widthIfEmpty=100&heightIfEmpty=200&e={bmThirdPartyID}&site=clientsite&wid=12345&rno=0" alt="Just for you" title="Just for you" /></a>
    ```
    :::

    ![Image: Paste copied HTML code](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/uLJFSy4sqUIktn0SlI_5q-20260720-150236.png "Image: Paste copied HTML code")
17. Click **Apply**.
