---
title: "Integrate Evidential with messaging platforms"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.evidential.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate Evidential with messaging platforms

Evidential decides which arm each participant is in. Your messaging platform delivers the content for that arm.

Evidential integrates directly with **Turn.io**. For other platforms, your app can request assignments through the
[API](https://docs.evidential.dev/api/). See [Integrate Evidential with your application](https://docs.evidential.dev/guides/integrate-with-the-api/).

## Turn.io

[Turn.io](https://whatsapp.turn.io/) organizes WhatsApp conversations into **journeys**. With the Evidential Turn.io
App, each arm of your experiment is linked to a journey. When a contact enters your experiment, the app gets their arm
from Evidential and starts the matching journey.

### Before You Start

You'll need:

- A **base journey** where contacts enter the experiment.
- One **arm journey** for each arm, with the content for that arm. If you're running a bandit where contacts' results
  are collected in Turn.io, each arm journey should also collect the result.
- An experiment in Evidential. See [Experiment design types](https://docs.evidential.dev/concepts/experiment-design-types/).

### Set Up the Connection

You only need to do this once for your organization.

1. **Create a Turn.io API token**

   In Turn.io, go to **Settings > API & Webhooks > Create a Token**.

2. **Add the token to Evidential**

   In Evidential, go to **Integrations** and click **Add API Key** in the **Turn.io API Key** section. Evidential
   loads your journeys and creates a **Webhook ID** and **Webhook Auth Token** for Turn.io.

3. **Install and connect the app in Turn.io**

   On the Evidential **Integrations** page, download the Evidential Turn.io App. In Turn.io, go to **Apps > Installed
   Apps > Upload app**, upload the .zip file, and click **Install app**. Then open the app's **Settings** page in
   Turn.io and paste in the **Webhook ID** and **Webhook Auth Token**.

### Set Up an Experiment

Do this for each experiment you run in Turn.io.

1. **Link arms to journeys**

   In Evidential, open your experiment and click **Integration Guide**. Under **Configure integration for third-party
   tools**, choose a journey for each arm and click **Save**.

2. **Copy the Experiment ID (and set an API key, if needed)**

   In the same Integration Guide, copy the **Experiment ID**. Only needed the first time (or when switching data
   sources): if the app doesn't have an Evidential API key for this data source yet, click **Add API Key**, copy the
   key right away (it isn't shown again), and paste it into the Evidential app's **Settings** page in Turn.io. One key
   works for every experiment on the same data source.

3. **Route contacts to the experiment**

   In your base journey, add a step that calls the app's `route_to_experiment` function with the Experiment ID. The
   app's **About** page in Turn.io has full instructions.

4. **Record results, if needed**

   For a **Multi-armed Bandit**, add a step to each arm journey that calls the app's `post_outcome_for_contact`
   function with the contact's result. Skip this step for A/B tests and DWH-connected bandits, which read results from
   your data warehouse.

5. **Publish the app and your journeys**

   Publish the Evidential app (if you changed its settings) and your updated journeys in Turn.io so contacts can enter
   the experiment.

### What Happens When a Contact Enters

1. The contact reaches the step in your base journey that calls the app.
1. The app asks Evidential for the contact's arm, using the contact's WhatsApp ID as the participant ID.
1. The app saves the experiment ID and arm ID to the contact's profile, then starts the journey linked to that arm.

If a contact enters again, Evidential returns the same arm.

### Things to Know

- **Participant IDs are WhatsApp IDs.** For a **Preassigned A/B** experiment, the column that identifies participants
  in your participant table must contain your contacts' WhatsApp IDs. Otherwise, Evidential won't find their
  assignments.
- **Online A/B filters aren't applied.** The app doesn't send contact details when it asks for an assignment, so every
  contact routed to an Online A/B experiment is enrolled. To limit who takes part, add conditions to your base journey
  before the step that calls the app.
- **Contextual bandits aren't supported.** The app doesn't send context values when it asks for an assignment, so it
  can't run a **Contextual Multi-armed Bandit**.
- **Journey changes sync automatically.** When you add, rename, or delete journeys in Turn.io, the app notifies
  Evidential automatically (checked at most once every 5 minutes while running, or immediately when you save the app's
  settings). Saving a different Turn.io API key in Evidential also refreshes the list.
- **Fix out-of-date links.** If a linked journey is deleted, the **Integration Guide** button turns red and the
  affected arms show a warning. Choose a new journey for each flagged arm and click **Save**.
- **One Turn.io workspace per organization.** Each organization can connect one Turn.io API token.
- **Deleting the connection removes all links.** If you delete the Turn.io API key in Evidential, the links between
  arms and journeys are deleted for every experiment in your organization, including running ones. The Webhook ID and
  Webhook Auth Token are deleted too, so after you add a new key, paste the new ones into the app.

### Security

- Evidential stores your Turn.io API token encrypted.
- If you think the Webhook Auth Token has been exposed, click the rotate button next to it on the **Integrations**
  page. The old token stops working immediately, so paste the new one into the app's settings in Turn.io.
- The Evidential API key only works for experiments on its data source. Manage your keys on the data source's page in
  Evidential.

## Other Platforms

To run experiments on other messaging or survey platforms:

- For **Preassigned A/B**, download the assignments as a CSV or fetch them through the API. Then tag each contact in
  your platform with their arm, so your flows can branch on it.
- For **Online A/B** and **bandits**, have your app request each participant's assignment from Evidential when they
  arrive, then show them the content for their arm.

See [Integrate Evidential with your application](https://docs.evidential.dev/guides/integrate-with-the-api/) for details, or
[contact us](https://docs.evidential.dev/contact/) to ask about support for your platform.

Source: https://docs.evidential.dev/guides/integrate-with-messaging-platforms/index.mdx
