Skip to main content
All CollectionsIntegrations
How to set up a webhook in Klaviyo
How to set up a webhook in Klaviyo
Updated over a week ago

Klaviyo's powerful features allow you to segment your contacts and build lists that precisely meet your needs. With Kiosk's integration with Klaviyo, you can:

  1. Access Klaviyo's lists in Kiosk's Campaigns tab.

  2. Use Webhooks to add a WhatsApp step to your Klaviyo Flow.

βš™οΈ What is a Webhook?
A webhook is a method for one app to send real-time data to another app. It delivers information as events happen, ensuring immediate data transfer.

This guide will walk you through setting up a webhook in Klaviyo so that every contact reaching a specific step in your flow will receive a WhatsApp message.

Step by step guide

  1. Connect Your Klaviyo Account

    • Ensure your Klaviyo account is connected in the Integrations tab of Kiosk.

  2. Create an API Key in Kiosk

  3. Create or Edit a Klaviyo Flow

    • Create a new Klaviyo Flow or open the one where you want to send a WhatsApp message.

  4. Add a Webhook Step

    • In your Klaviyo Flow, add a Webhook step.

  5. Set Up the Webhook

    Provide all the necessary information for your Kiosk automation:

    1. Destination URL: Paste this link: https://api.kiosk.so/v0/scenarios/trigger

    2. Headers:

      • Key: X-API-KEY

      • Value: (The API Key you created in step 2)

  6. JSON Body: Match your Kiosk automation's variables with Klaviyo properties.

    1. For each flow, the first variable to map is the phone number. Here we want to provide WhatsApp with the phone number of the contact reaching this step of the flow. The format of the property should be:

      "phoneNumber": "{{ person.phone_number|default:'' }}"

      Verify the property in Klaviyo by clicking on "View Profile & Event Properties" > Profile > Phone Number".

    2. Include a default Country Code in case the phone number isn't formatted in ISO 3166-1 alpha-2. For example, if most of your clients are in Great Britain:

      "phoneNumberCountryCode": "GB"

      You can find the full list right here and we advice selecting the most frequent one among your clients.

    3. Provide the Automation ID

      • Go to the Kiosk Automation you want to be triggered and find the scenario ID at the end of the URL.

      • Your JSON body should now look like this:

        {
        "phoneNumber": "{{ person.phone_number|default:'' }}",
        "phoneNumberCountryCode": "GB",
        "scenarioId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
        }
  7. Handle Custom Variables (if any)

    • If your automation doesn't contain any variables, you can just complete your code with this last line and you're done!

      {
      "phoneNumber": "{{ person.phone_number|default:'' }}",
      "phoneNumberCountryCode": "GB",
      "scenarioId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "variables": []
      }
    • If your automation contains one custom variable or more, keep on with step 8.

  8. Our goal here is to insert the ID of the Custom Variables included in the automation. For each variable of your automation, provide both its ID and value.

    For example, in an automation containing a custom variable called "first name", these are the steps:

    1. Find the Variable ID:

      • After authorizing access with the API key created in step 2, navigate to Scenarios > GET > v0/scenarios/{id} and paste the scenario ID found in step 6c.

      • In the response body, look for your custom variable name. The ID will be located right above or below it.

    2. Find the Variable Value:

      • Repeat the process from step 6.a to find the right property in Klaviyo. For the contact's first name, the format is {{ person.first_name|default:'' }}.

      Example:

      {
      "phoneNumber": "{{ person.phone_number|default:'' }}",
      "phoneNumberCountryCode": "GB",
      "scenarioId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "variables": [
      {
      "variableId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "value": "{{ person.first_name|default:'' }}"
      }
      ]
      }
  9. Save the Webhook

    • Repeat the process for each variable and save the webhook.

Congratulations! By following these steps, you'll seamlessly integrate WhatsApp messaging into your Klaviyo flows using Kiosk πŸ’«

Did this answer your question?