# Trigger Drip Campaign API

This page introduces the Send WhatsApp Campaign API from QuickReply.ai, a powerful tool designed to enhance your marketing efforts by enabling you to send or schedule messages directly to your custom\
\
Whether you're looking to trigger a time-sensitive offer, a reminder for an event, or a drip campaign to engage your audience, this API simplifies the process. By leveraging this API, you ensure that your message reaches your audience at the right time, every time.\
\
With prerequisites including an approved template, sufficient wallet balance, and adherence to daily [messaging limits](/overview/messaging-channels/whatsapp/concepts.md#messaging-limits), this API is ready to elevate your marketing strategy on WhatsApp.

## Trigger Drip Campaign API

This API helps you to send/ schedule a message to the end-user using an API.

{% hint style="info" %}
This API requires an active WhatsApp Account on QuickReply.ai along with a non-negative WhatsApp Wallet Balance
{% endhint %}

**Pre-requisites**

* The WhatsApp Template is already approved
* You have Messaging Credits Wallet balance to send the template message
* You have not exceeded your daily messaging limit on your WhatsApp number

## Send WhatsApp Custom Campaign Message by API

<mark style="color:green;">`POST`</mark> `https://app.quickreply.ai/api/campaign/{{campaign_id}}/event`

The body is a JSON Object

#### Query Parameters

| Name                                           | Type   | Description                                                                                                                |
| ---------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------- |
| campaign\_id<mark style="color:red;">\*</mark> | String | You can find the Campaign ID by clicking on the 3 dots at the right of the Campaigns block and clicking "Copy Campaign Id" |

#### Headers

| Name                                           | Type   | Description                                                                                                                                     |
| ---------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| client-id<mark style="color:red;">\*</mark>    | String | You can find client-id of your account in [Settings > Developers > API credentials](https://app.quickreply.ai/v2/settings/dev/api-credentials)  |
| secret-key<mark style="color:red;">\*</mark>   | String | You can find secret-key of your account in [Settings > Developers > API credentials](https://app.quickreply.ai/v2/settings/dev/api-credentials) |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                                                |

#### Request Body

| Name                                    | Type                            | Description                                                                                                                                                                                                                                                                                                             |
| --------------------------------------- | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| phone<mark style="color:red;">\*</mark> | String                          | Phone number of the recipient                                                                                                                                                                                                                                                                                           |
| name                                    | String                          | Name of recipient                                                                                                                                                                                                                                                                                                       |
| execute\_at                             | Epoch Timestamp in milliseconds | The time when you want to send the message.                                                                                                                                                                                                                                                                             |
| media\_url                              | URL                             | <p>// Required - if the template is of type media</p><p>Public accessible media URL for Media Templates like an Image, Video, or Document.</p><p>IMAGE:<br>Supported types: image/jpeg, image/png</p><p>VIDEO:<br>Supported types: video/mp4, video/3gpp</p><p>DOCUMENT:</p><p>Supported types: Any valid MIME-type</p> |
| MORE CUSTOM FIELDS                      | Key-Value Pairs                 | More data in the key-value format used in campaign params and button params                                                                                                                                                                                                                                             |
| event\_id                               | String (50 chars)               | <p>Event identifier that can be passed and accessed in the <strong>Playbooks (Custom Bots)</strong></p><p><strong>Bot Reference</strong> field: user.context.event\_id</p>                                                                                                                                              |

{% tabs %}
{% tab title="200: OK When message is successfully sent" %}

```json
{
    "id": "<message_id>",
    "state": "SENT"
}
```

{% endtab %}

{% tab title="400: Bad Request When recipient is missing" %}

```json
{
    "error": "Phone not found!"
}
```

{% endtab %}

{% tab title="400: Bad Request When campaign id is missing or is wrong" %}

```json
{
    "error": "Campaign not found"
}
```

{% endtab %}

{% tab title="Untitled" %}

{% endtab %}

{% tab title="401: Unauthorized When client-id or secret-key is missing or wrong" %}

```json
{
    "error": "Unauthorized"
}
```

{% endtab %}

{% tab title="400: Bad Request When message fails at WhatsApp" %}

```json
{
    "id": "<message_id>",
    "state": "NOT_SENT",
    "reason": "<Error from WhatsApp>"
}
```

{% endtab %}

{% tab title="202: Accepted When message is scheduled successfully" %}

```json
{
    "id": null,
    "state": "SCHEDULED",
    "scheduled_at": 1707379191 // Epoch time at which message will go.
}
```

{% endtab %}

{% tab title="400: Bad Request When campaign is not set up properly" %}

```json
{
    "error": "Campaign not active"
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Fields marked with [\*️](https://emojipedia.org/asterisk/) are Required.
{% endhint %}

#### Sample CURL Request

```sh
curl --location --request POST 'https://app.quickreply.ai/api/campaign/XSSsd8AdrSMFfWrW_camp/event' \
--header 'client-id: Dpg3vnsdjfXwoSGNrT52G_c' \
--header 'secret-key: MDbkebDsldf9adsjbKJ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "phone": "+919634687270",
    "execute_at": "1707208191000",
    "name": "Utkarsh",
    "event_id": "XXXXXXXXXXXXXXXXXXXX",
    "var_1": "Blue Ribbon",
    "var_2": "4",
    "var_3":"₹4500",
    "media_url":"https:/some-public-domain/sample_image.jpeg"
}'
```


---

# 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://docs.quickreply.ai/developer/apis/trigger-drip-campaign-api.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.
