---
title: "Configure a custom action for a triggered personalization"
slug: "configure-the-custom-action-for-a-triggered-personalization"
abstract: "Learn how to configure and preview a custom API request that sends data to a webhook."
---
# Configure a custom action for a triggered personalization

> [!important]
> Feature availability is part of a phased rollout. Your organization may not see this functionality yet. It will become available when your environment is included in the rollout.

Use the **New API request** action to send a custom payload to a webhook when the trigger occurs and any configured conditions are met.

The webhook connects SitecoreAI to an external system, such as a CRM, loyalty platform, order management system, or another API.

The payload can include dynamic values from visitor profile and event data. For example, you can send customer details and form data to a CRM after a qualifying visitor submits a form.

You configure the webhook URL, HTTP method, authentication, headers, and request body. You can then preview the request with a test profile to verify how dynamic values are resolved before you publish the personalization.

## Configure the API request

Define the webhook destination and the payload that SitecoreAI sends when the personalization is triggered.

To configure the API request:

1. On the **Configuration** page, in the **Triggered action** section, click **New API request**.
2. Enter a descriptive **Name** for the action.
3. Select the HTTP **Method** and enter the webhook **URL**.

   > [!note]
   > To include dynamic values, use `${variableName}` or `{{variableName}}` in the URL, header values, or request body.

4. Click **Default headers** and configure the headers required by the destination.
5. Optionally, click :mdiPlus: **Add header** to add more headers.
6. In **Authentication**, select the method required by the webhook destination:

   - **No authentication** - sends the request without authentication credentials.
   - **Basic** - sends a username and password with the request.
   - **API key** - sends an API key provided by the destination service.
   - **OAuth 2.0** - uses client credentials to obtain an access token for the request.
   
7. In the **Request body template**, define the JSON payload that SitecoreAI sends to the webhook.

   > [!note]
   > You can include dynamic values in the payload. These values are resolved using data available when the personalization runs.

   For example, you can send visitor and event data to a CRM when a qualifying visitor submits a form:

      ```json
         {      
         "firstName": "{{firstName}}",
         "email": "{{email}}",
         "country": "{{country}}",
         "source": "product-demo-form"      
         }
      ```
   
   When the personalization is triggered, SitecoreAI resolves the dynamic values and sends the resulting payload to the configured webhook.

8. Click **Test request**, map each variable to the visitor profile or event field that supplies its value, and click **Run test** to check whether the request succeeded.

9. Click **Save & continue**. You are now ready to preview the request by testing it with a profile.



## Preview the webhook request

Use a visitor profile to test how dynamic values are resolved before you publish the personalization.

To preview the webhook request:

1. In the upper-right corner, click **Test**.
2. In the **Test API call** dialog, in **Profile**, choose one of the following:

   - **Load profile** - enter a visitor's client ID or profile ID. To retrieve these IDs, use [inspect mode](https://doc.sitecore.com/sai/en/users/sitecoreai/audience-and-insights/profiles/view-profile-details.html#use-inspect-mode "Use inspect mode").
   - **Generate profile** - use AI to generate a test profile from a natural-language prompt.

3. If you selected **Generate profile**:

   - Enter a description of the profile you want to test.
   - Example: *A person called John Doe*
   - Click **Generate**.

    After the profile is loaded or generated, optionally click **View JSON** to review the profile data.

4. Optionally, in **Event**, click **View JSON** to review the event data.
5. Click **Send test request**.

Review the payload to make sure its data and JSON structure match what the webhook destination expects.


## Next steps

After you verify the request, [publish the triggered personalization](https://doc.sitecore.com/sai/en/users/sitecoreai/triggered-personalization/publish-a-triggered-personalization.html) immediately or schedule it for later.
