# POST /broadcasts/send — Send API Campaign

> Product: **Pabbly Chatflow** (v1)
> Base URL: `https://chatflow.pabbly.com/api/v1`
> Auth: Bearer via `Authorization` header
> Canonical: `/chatflow/broadcasts/send-api-campaign`

Hit the API with POST method and fill the following data according your requirements to send broadcast.

**Body parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| templateName | string | Yes | Name of the template you want to send. |
| campaignName | string | Yes | Name of API Broadcast you want to send. |
| destination | string | Yes | Phone number followed by the dialing code. |
| userName | string | Yes | Contact name used to create a contact if the destination number doesn't exist in your contacts. |
| headerParams | array | No | Parameter values that can be dynamically inserted into the template. E.g., Parameter {{1}} will be replaced in the template with the given value. |
| bodyParams | array | No | Parameter values that can be dynamically inserted into the template. You can add multiple parameters, which will be sent to the user according to their respective index. E.g., Parameter {{1}} will be replaced in the template with the given value. |
| source | string | Yes | source is used to create a contact if the destination number doesn't exist. Its value must be one of the following: 'manual', 'csv', 'api', 'user', 'sync', or 'wa'. |
| link | string | No | link is required as a valid URL to your file if the template has an attached file. |
| filename | string | No | filename is only used if you're sending a template with a document type. |
| defaultContactFieldValues | object | No | defaultContactFieldValues is a set of key-value pairs used as fallback attributes when a contact's attribute is missing or empty. |
|   ↳ Country | string | No |  |

**Example request body:**

```json
{
    "templateName": "festival_offer_template",
    "campaignName": "festival offer",
    "destination": "9176978xxxxx",
    "userName": "Jon",
    "headerParams": [
        "Sir"
    ],
    "bodyParams": [
        "Christmas",
        "Thank You"
    ],
    "source": "api",
    "link": "https://placehold.co/600x400/EEE/31343C.png",
    "filename": "filename",
    "defaultContactFieldValues": {
        "Country": "India"
    }
}
```

**Response (200)** — Send API Campaign:

```json
{
    "success": "true",
    "data": {
        "messaging_product": "whatsapp",
        "contacts": [
            {
                "input": "9176978xxxxx",
                "wa_id": "9176978xxxxx"
            }
        ],
        "messages": [
            {
                "id": "wamid.HBgMOTE3Njk3ODYyMTE1FQIAERgSNzI5RDAyQUJBRUNBxxxxxxxxxx==",
                "message_status": "accepted"
            }
        ],
        "code": 200
    }
}
```

**Code examples:**

_cURL_

```curl
curl -X POST https://chatflow.pabbly.com/api/v1/broadcasts/send \
  -H "Authorization: Bearer {{YOUR_API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{
    "templateName": "festival_offer_template",
    "campaignName": "festival offer",
    "destination": "9176978xxxxx",
    "userName": "Jon",
    "headerParams": [
      "Sir"
    ],
    "bodyParams": [
      "Christmas",
      "Thank You"
    ],
    "source": "api",
    "link": "https://placehold.co/600x400/EEE/31343C.png",
    "filename": "filename",
    "defaultContactFieldValues": {
      "Country": "India"
    }
  }'
```

_Ruby_

```ruby
require 'net/http'
require 'json'

uri = URI('https://chatflow.pabbly.com/api/v1/broadcasts/send')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer {{YOUR_API_KEY}}'
request['Content-Type'] = 'application/json'
request.body = "{\"templateName\":\"festival_offer_template\",\"campaignName\":\"festival offer\",\"destination\":\"9176978xxxxx\",\"userName\":\"Jon\",\"headerParams\":[\"Sir\"],\"bodyParams\":[\"Christmas\",\"Thank You\"],\"source\":\"api\",\"link\":\"https://placehold.co/600x400/EEE/31343C.png\",\"filename\":\"filename\",\"defaultContactFieldValues\":{\"Country\":\"India\"}}"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(request)
end

data = JSON.parse(response.body)
```

_Python_

```python
import requests

response = requests.post(
    'https://chatflow.pabbly.com/api/v1/broadcasts/send',
    headers={'Authorization': 'Bearer {{YOUR_API_KEY}}'},
    json={
    'templateName': 'festival_offer_template',
    'campaignName': 'festival offer',
    'destination': '9176978xxxxx',
    'userName': 'Jon',
    'headerParams': [
        'Sir'
    ],
    'bodyParams': [
        'Christmas',
        'Thank You'
    ],
    'source': 'api',
    'link': 'https://placehold.co/600x400/EEE/31343C.png',
    'filename': 'filename',
    'defaultContactFieldValues': {
        'Country': 'India'
    }
},
)

data = response.json()
```

_PHP_

```php
<?php
$ch = curl_init('https://chatflow.pabbly.com/api/v1/broadcasts/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer {{YOUR_API_KEY}}', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"templateName":"festival_offer_template","campaignName":"festival offer","destination":"9176978xxxxx","userName":"Jon","headerParams":["Sir"],"bodyParams":["Christmas","Thank You"],"source":"api","link":"https://placehold.co/600x400/EEE/31343C.png","filename":"filename","defaultContactFieldValues":{"Country":"India"}}');

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
```

_Java_

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
    .uri(URI.create("https://chatflow.pabbly.com/api/v1/broadcasts/send"))
    .header("Authorization", "Bearer {{YOUR_API_KEY}}")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\"templateName\":\"festival_offer_template\",\"campaignName\":\"festival offer\",\"destination\":\"9176978xxxxx\",\"userName\":\"Jon\",\"headerParams\":[\"Sir\"],\"bodyParams\":[\"Christmas\",\"Thank You\"],\"source\":\"api\",\"link\":\"https://placehold.co/600x400/EEE/31343C.png\",\"filename\":\"filename\",\"defaultContactFieldValues\":{\"Country\":\"India\"}}"));

HttpRequest request = builder.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

_Node.js_

```node
const response = await fetch('https://chatflow.pabbly.com/api/v1/broadcasts/send', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer {{YOUR_API_KEY}}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "templateName": "festival_offer_template",
    "campaignName": "festival offer",
    "destination": "9176978xxxxx",
    "userName": "Jon",
    "headerParams": [
      "Sir"
    ],
    "bodyParams": [
      "Christmas",
      "Thank You"
    ],
    "source": "api",
    "link": "https://placehold.co/600x400/EEE/31343C.png",
    "filename": "filename",
    "defaultContactFieldValues": {
      "Country": "India"
    }
  }),
});

const data = await response.json();
```

_Go_

```go
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := strings.NewReader("{\"templateName\":\"festival_offer_template\",\"campaignName\":\"festival offer\",\"destination\":\"9176978xxxxx\",\"userName\":\"Jon\",\"headerParams\":[\"Sir\"],\"bodyParams\":[\"Christmas\",\"Thank You\"],\"source\":\"api\",\"link\":\"https://placehold.co/600x400/EEE/31343C.png\",\"filename\":\"filename\",\"defaultContactFieldValues\":{\"Country\":\"India\"}}")
    req, _ := http.NewRequest("POST", "https://chatflow.pabbly.com/api/v1/broadcasts/send", payload)
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer {{YOUR_API_KEY}}")

    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    fmt.Println(string(body))
}
```

_.NET_

```dotnet
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://chatflow.pabbly.com/api/v1/broadcasts/send");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer {{YOUR_API_KEY}}");
request.Content = new StringContent("{\"templateName\":\"festival_offer_template\",\"campaignName\":\"festival offer\",\"destination\":\"9176978xxxxx\",\"userName\":\"Jon\",\"headerParams\":[\"Sir\"],\"bodyParams\":[\"Christmas\",\"Thank You\"],\"source\":\"api\",\"link\":\"https://placehold.co/600x400/EEE/31343C.png\",\"filename\":\"filename\",\"defaultContactFieldValues\":{\"Country\":\"India\"}}");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

var response = await client.SendAsync(request);
var data = await response.Content.ReadAsStringAsync();
Console.WriteLine(data);
```

---

**Other endpoints in Broadcasts:**

- [POST /broadcasts — Send Broadcast with Regular Message](/chatflow/broadcasts/send-broadcast-with-regular-message)
- [POST /broadcasts — Send Broadcast with Template Message](/chatflow/broadcasts/send-broadcast-with-template-message)
- [POST /broadcasts — Add API Campaign](/chatflow/broadcasts/add-api-campaign)

