Skip to main content
Users
CloudPortalLogin
  • Powered byPowered by
Introduction to Sitecore Personalize
Managing accounts and system settings
Identifying guests
Introduction to experiments
Introduction to experiences
Decisioning
View dashboards
Developer Center
Connecting to an external system
Using client-side JavaScript
Using server-side JavaScript
Glossary
  • Sitecore Personalize
  • Introduction to experiments in Sitecore Personalize
  • Introduction to triggered experiments in Sitecore Personalize
  • Compose the API request for an experiment

Compose the API request for an experiment

After you compose a webhook for a triggered experiment, you must compose the API request to include the offer or content returned by a decision model to send to the chosen webhook destination.

The API request enables you to include dynamic data from the guest data model and experiment response. For example, you might want the variant for the triggered experiment to include the guest's first name, location, loyalty number, etc. You configure the request using FreeMarker.

To compose the API request for a triggered experiment:

  1. In the API editor, on the API request tab, use the drop-down list to select the external destination you want to send data to.

  2. Optionally, to add more headers to the request, click Add headers.

    Note

    You can't include FreeMarker variables in the headers that you add here. If you need FreeMarker variables in headers, you have to create them when you're configuring the request to an external destination.

  3. If the connection contains FreeMarker variables, click Set variable values to specify a value for every variable. Then, click Save.

    Note

    Wrap string values in double quotes, for example, "test-value".

  4. Click the API body tab and compose the API request body.

    You can include variables by using the FreeMarker variable notation ${}. For example, you can copy and paste dynamic data from the guest data model and decision model response, as required.

    Here's an example of the API request body for an abandoned cart email using variables for the guest data model:

    RequestResponse
    {
      "from": "[email protected]",
      "to": "${guest.email}",
      "subject": "Don't forget your favorite pair of shoes",
      "body": "Hello, ${guest.firstName}. We noticed that you left a pair of shoes in your cart..."
    }
  5. Click Save.

  6. Click to close the API editor.

Do you have some feedback for us?

If you have suggestions for improving this article,

Privacy policySitecore Trust CenterCopyright © 1999-2025 Sitecore