### Klaviyo Webhook Trigger Setup Source: https://help.hello-charles.com/en/articles/210064-how-to-set-up-the-klaviyo-webhook-trigger This section details the process of setting up a webhook trigger in Klaviyo to initiate a charles flow. It covers creating the flow, selecting the trigger, and configuring the webhook URL and API key. ```APIDOC ## Setting Up the Klaviyo Webhook Trigger ### Description This guide explains how to trigger a charles flow from within a Klaviyo flow using a webhook. ### Method POST ### Endpoint [Webhook URL provided by charles] ### Parameters #### Query Parameters - **api_key** (string) - Required - The API key provided by charles. #### Request Body - **phone_number** (string) - Required - The phone number of the recipient. This can be dynamically populated from Klaviyo event properties. - **external_reference_id** (string) - Required - A unique identifier for the contact, used if phone number is not available. This can be dynamically populated from Klaviyo event properties. ### Request Example ```json { "phone_number": "{{ event.properties.phone_number }}", "external_reference_id": "{{ event.properties.external_id }}" } ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the webhook was processed successfully. #### Response Example ```json { "message": "Webhook received and processed successfully." } ``` ### Notes - The Klaviyo trigger is only available on specific contracts. Contact your Customer Success Manager or Support team for access. - As of January 2025, flows can be triggered for contacts without phone numbers using `external_reference_id`, provided they were imported previously. - Refer to the [Klaviyo webhook guide](https://help.klaviyo.com/hc/en-us/articles/4534329515931-Understanding-Klaviyo-Webhooks) for more information on webhooks. ``` -------------------------------- ### Charles Flow Payload Example Source: https://help.hello-charles.com/en/articles/365574-how-to-set-up-an-emarsys-automation An example of a payload structure that can be received by a Charles flow when triggered by an Emarsys event. This demonstrates how to structure data for personalization within the Charles platform. ```json { "birthdate": "", "discount_code": "" } ``` -------------------------------- ### Charles Journeys - Emarsys Trigger Setup Source: https://help.hello-charles.com/en/articles/210073-emarsys-birthday-campaign Instructions for setting up a new flow in Charles Journeys triggered by an Emarsys event. ```APIDOC ## Emarsys Trigger in Charles Journeys ### Description Configure a new flow in Charles Journeys to be initiated by an Emarsys custom event, specifically for birthday campaigns. ### Method N/A (Configuration within Charles UI) ### Endpoint N/A (Configuration within Charles UI) ### Parameters #### Trigger Configuration - **Trigger Type**: Emarsys - **Event Type**: Custom Event - **Event Name**: "birthday" (Must match the `event_name` sent via webhook) #### Request Body (JSON Payload) - Paste the JSON payload received from Emarsys testing environment into the journey trigger. ### Request Example (JSON Payload from Emarsys) ```json { "contact": { "external_reference_id": "emarsys_contact_id_123", "email": "test@example.com", "phone": "+491711234567" }, "event_data": { "birthday": "2023-10-27" } } ``` ### Response #### Success Response (Configuration Saved) - The flow is configured and ready to be published. #### Response Example N/A (Configuration within Charles UI) ``` -------------------------------- ### Braze Webhook JSON Payload Example Source: https://help.hello-charles.com/en/articles/377593-how-to-set-up-a-braze-automation This JSON payload demonstrates the structure for sending user data and custom attributes from Braze to charles. It includes essential fields like phone, external_id, event_name, and an optional custom_data object for personalization. ```json { "phone": "your_phone_number", "external_id": "your_user_ID", "custom_data": { "language": "German ("de")" }, "event_name": "Braze_event_name" } ``` -------------------------------- ### Configure Website Security Settings (CSP) Source: https://help.hello-charles.com/en/articles/209814-create-a-chat-bubble This snippet shows how to update your website's Content Security Policy (CSP) to allow necessary scripts and images for the chat bubble. It requires adding specific domains to the script-src and img-src directives. Ensure these are correctly implemented by your developers to avoid issues with bubble functionality. ```text script-src: *.storage.googleapis.com img-src: *.storage.googleapis.com ``` -------------------------------- ### Configure GET Request for Outgoing Webhook Node Source: https://help.hello-charles.com/en/articles/206496-outgoing-webhook-node This snippet illustrates the configuration steps for a GET request using the Outgoing Webhook node. It involves specifying the request method, URL, and authorization headers, followed by previewing and selecting data variables for use in the flow. ```text 1. Configure the node by specifying the GET request method 2. Add the URL you want to retrieve data from, as well as an authorization header (if necessary) 3. Preview the available data and select which variables you wish to further use within the flow ``` -------------------------------- ### JSON Payload for Opt-In Promotion Configuration Source: https://help.hello-charles.com/en/articles/322568-how-to-set-up-a-charles-x-karla-flow This JSON payload is used to configure an opt-in promotion, capturing customer and event data. Adjust the 'carrier_url' to your specific website domain. It includes fields for email, carrier information, location data, and order details. ```json { "email": "{{ person.email }}", "carrier": "{{ event.carrier|default:'' }}", "zip_code": "{{ event.zip_code|default:'' }}", "firstname": "{{ person.first_name|default:'' }}", "external_reference_id": "{{person.KlaviyoID}}", "carrier_url": "{{ event.tracking_url|default:'' }}", "order_number": "{{ event.order_number|default:'' }}", "phone_number": "{{ person.phone_number|default:'' }}", "pick_up_until": "{{ event.pick_up_until|default:'' }}", "neighbour_name": "{{ event.neighbour_name|default:'' }}", "pick_up_address": "{{ event.pick_up_address|default:''}}", "tracking_number": "{{ event.tracking_number|default:'' }}", "karla_trackpage_url": "https://de.WEBSITE.DE/pages/tracking?orderNumber={{ event.order_number|default:'' }}&zipCode={{ event.zip_code|default:'' }}&ref=karla" } ``` -------------------------------- ### Journey trigger (Start a flow) Source: https://help.hello-charles.com/en/articles/233780-api-document-journey-trigger This endpoint allows you to trigger a specific journey flow for a given organization. You can also pass custom data to personalize the journey. ```APIDOC ## POST /webhooks/v0/rest-trigger/organization/{ORGANIZATION ID}/flow/{FLOW ID}/trigger/ ### Description Triggers a specific journey flow for a given organization. Custom key-value pairs can be included in the request body to personalize WhatsApp messages within the journey. ### Method POST ### Endpoint `https://journeys.hello-charles.com/webhooks/v0/rest-trigger/organization/{ORGANIZATION ID}/flow/{FLOW ID}/trigger/` ### Parameters #### Path Parameters - **ORGANIZATION ID** (string) - Required - The unique identifier for the organization. - **FLOW ID** (string) - Required - The unique identifier for the flow to be triggered. #### Headers - **Content-Type**: `application/json` - **X-API-Key**: `` - Required - Your API key for authentication. Obtain this from `Settings` > `API Keys`. #### Request Body - **phone_number** (string) - Required - The recipient's phone number, including the country code (e.g., `491573758431`). - **[any_key]** (any) - Optional - Any additional key-value pairs to personalize the journey. These can include nested structures. ### Request Example ```json { "phone_number": "", "first_name": "Max", "last_name": "Mustermann", "discount_code": "happybday24" } ``` ### Response #### Success Response (200) - **message** (string) - Indicates that the flow was triggered successfully. #### Response Example ```json { "message": "Triggered flow successfully." } ``` #### Error Responses - **401**: Unauthorized - Invalid or missing API key. - **500**: Internal server error. Please try again later. ``` -------------------------------- ### Fetch Product Details by ID using 'get_product' Source: https://help.hello-charles.com/en/articles/219673-journeys-define-variable-node This snippet shows how to use the 'get_product' function to retrieve metadata for products when only their IDs are available. It takes a product ID as input and returns an object containing product details like name, price, currency, and image URL. This is useful for enriching event data. ```liquid {%- for id in REST_TRIGGER.emarsys_product_id -%} {% assign product = id | get_product: 'id' %} - {{ product.name }}: {{ product.price }}{{ product.currency }} {%- endfor -%} ``` ```liquid {% assign product = REST_TRIGGER.emarsys_product_id[0] | get_product: 'id' %} {{ product.assets_gallery_image_url[0] }} ```