# Building Ongoing Campaign

{% hint style="info" %}
Available on the **STARTER** plan and above.
{% endhint %}

### Pre-requisites:&#x20;

Depending on the channel you want to broadcast on, you would need,

* Email API (Supported partner: TechAlpha)
* SMS API (Supported partner: Twilio)
* MMS API (Supported partner: TechAlpha)
* WhatsApp API (Supported partner: Meta, 360dialog, Twilio, GupShup, TechAlpha, Unifonic)

{% hint style="info" %}
If you do not have an API, you can reach out to sales at **`hello@wotnot.io.`**
{% endhint %}

{% embed url="<https://www.loom.com/share/1ba7323db31f495baaaec4564be78559?sid=9a64f62d-20d2-41fe-96eb-1eda4bad8447>" %}

## Step 1: Create an outbound bot

1. Goto Bot builder&#x20;
2. Choose "Build a bot" then select "Build an outbound bot"
3. Select "Ongoing" campaign as we want this broadcast to run when contacts are enrolled

<figure><img src="/files/YRh0BK1koUpGb7bzqdOp" alt=""><figcaption></figcaption></figure>

## Step 2: Configuring the webhook

Click on the 'Trigger' block and choose **Webhook** as the import source.&#x20;

Your system should invoke our webhook with the required contact payload to trigger them into this broadcast.&#x20;

To trigger this webhook, you will need:

* **Webhook URL** - Found on the trigger block
* **Authorization token** - Go to Settings > Account Settings > Developer
* **Payload** - The contacts data you want to send the broadcast to

## Adding contacts to campaign

<mark style="color:green;">`POST`</mark> `https://outbound.wotnot.io/api/v1/outbound/...`

You can find your webhook URL on the trigger block of your outbound bot.

<figure><img src="/files/isWahDVcGqWa0b4SqXXd" alt=""><figcaption></figcaption></figure>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

{% hint style="info" %}
**Token** — you can get your account token by going to Settings > Account Settings > Developer > and copy your "API Access Token"
{% endhint %}

**Body**

{% tabs %}
{% tab title="Single contact" %}

```json
{
  "id": 1,
  "name": "John",
  "phone": "12312313",
  "email": "test@test.com"
}
```

{% endtab %}

{% tab title="Multiple contacts" %}

```json
[
    {
    "id": "1",
    "name": "John Doe", 
    "phone": "18181818181", 
    "email": "example@email.com"
    },
    {
    "id": "2",
    "name": "James Doe", 
    "phone": "18282828282", 
    "email": "example@email.com"
    }
]
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
A maximum of **10,000 contacts** can be sent in single request
{% endhint %}

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "id": "7vrrqo3nwr3k130023374200bywmhn",
    "ok": true,
    "status": "in-progress"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "status": 400,
    "message": {
        "data": [
            "Not a valid list."
        ]
    },
    "ok": false,
    "error": "BAD_REQUEST"
}
```

{% endtab %}
{% endtabs %}

## Step 3: Map the response fields to variables

To store the contacts received from your webhooks, map the API response fields with the contact variables that you want to save it in.&#x20;

This mapping is done to help you dynamically replace values in the messages of your campaigns.&#x20;

<figure><img src="/files/Ehms7rxNN1erJLvlObeo" alt=""><figcaption></figcaption></figure>

For example, if you want to include a message like *"Hello {name}, glad we could meet on {date}",* you need to store the name and date field as variables in the contact mapping.

{% hint style="danger" %}
It is mandatory to have a phone/email field mapped, in order to be able to send a campaign to contacts.&#x20;
{% endhint %}

## Step 4: Create your campaign flow

Create your desired flow by adding blocks like **Send SMS** or **Send WhatsApp** and configure its fields on the right panel.

The configuration fields would differ based on the channel you use.&#x20;

<figure><img src="/files/523g9BwVMXULj874CqBv" alt=""><figcaption></figcaption></figure>

## Step 5: Deploy to activate this campaign

Once your flow has been created, double-check all the messages for typos or any other mistakes and hit **Deploy**. \
\
A confirmation prompt will be shown to you for final approval before launching the campaign.

Now, when your systems invokes the webhook, the contacts will be enrolled into this outbound bot flow.

{% hint style="info" %}
You can turn off your outbound bot, if you do not want to accept any new requests.&#x20;
{% endhint %}

## Viewing campaign reports

Once the bot is deployed, it may take a few minutes for the bot to finish sending all the messages to the recipients. This delay may vary based on the contact list and the API provider you have used.&#x20;

Wait for a few mins and then visit Analytics > Outbound to see the reports.

[Learn more](/monitor/reporting/outbound-report.md)

<figure><img src="/files/5OWqSNoL0A9R6v0LGRRE" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.wotnot.io/build/outbound-bots/building-ongoing-campaign.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
