Example Klavyio webhooks

This guide explains how to set up webhooks for integrating TRIFFT with Klaviyo flows. Webhooks enable real-time data transfer between TRIFFT and Klaviyo, allowing for automated actions based on user interactions.

Setting Up Webhooks in Klaviyo

1. Triggering a Flow with an Event from Drift or Another Source

Instead of using webhooks from Drift, Klaviyo flows can be triggered by an event imported from Drift or any other data stream. Ensure that the event data is correctly imported into Klaviyo to initiate automated actions.

2. Configuring the Webhook in Klaviyo

To set up a webhook in Klaviyo:

  1. Go to Flows in Klaviyo and open an existing flow or create a new one.

  2. Add a Webhook Action to the flow.

  3. Fill in the webhook details as follows:

    • Destination URL: https://api.trifft.io/v1/batch
    • Headers:
      • Key: "Authorization"
      • Value: "Bearer YOUR_TRIFFT_API_KEY"

    The YOUR_TRIFFT_API_KEY is the API key created in TRIFFT. You can find more information on generating API keys in TRIFFT’s Settings - API Keys documentation.

  4. Define the request method as POST and configure the payload format as needed.

3. Testing & Validation

To test the webhook setup:

  1. Open the webhook action in Klaviyo.
  2. Click Preview.
  3. Select the right profile, ensuring that the same profile exists in the TRIFFT project.
  4. Search for the correct profile and click Send Test Request.
  5. In TRIFFT’s CRM area, look at the member’s event flow to verify that the events are correctly flowing to TRIFFT.

Important Considerations

  • Klaviyo's Webhook URL Limitations:
    Klaviyo's webhook implementation does not support entering Jinja variables in the URL. To work around this limitation, TRIFFT offers a Batch API that serves as a wrapper to call any of our APIs without requiring variables in the URL. This approach avoids issues related to URL variable substitution. For more details, refer to TRIFFT's Batch API documentation.

  • Variable Notation in Klaviyo:
    When using variables in Klaviyo, ensure that there is a space before and after the curly brackets. For example, use {{ person.id }} instead of {{person.id}}. Omitting spaces can cause the variable to not work properly.

  • TRIFFT Member ID Notation:
    To reference a TRIFFT member ID in Klaviyo, use the notation person.id.

Example JSON Payloads

Below are examples of JSON payloads for common actions:

ActionJSON Payload
Assign Coupon to Member[
{
"uri": "/v1/member/{{ person.id }}/coupon/61d38741-9b79-4d57-b2a5-da4515b759fc/assign",
"method": "POST",
"payload": {
}
}
]
Add 100 Points to Member[
{
"uri": "/v1/member/None/wallet/add",
"method": "POST",
"payload": {
"points": 10000,
"note": null,
"timestamp": null
}
}
]

For a comprehensive understanding of TRIFFT's API capabilities, refer to the complete API reference available at https://docs.trifft.io/reference.

For more details on setting up webhooks in Klaviyo flows, refer to Klaviyo’s Understanding webhooks in flows guide.


By following this guide, you can effectively integrate TRIFFT with Klaviyo using webhooks, enabling seamless automation and enhanced user engagement.