# POST /broadcasts — Send Broadcast with Template Message

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

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

**Body parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| name | string | Yes | Name of Broadcast you want to create. |
| broadcastType | string | Yes | Type of the broadcast you want to create, this must be "broadcast". |
| messageType | string | Yes | Type of message, this must be "template" or "regular". |
| status | string | Yes | Status of Broadcast you want to create, this must be "scheduled" or "instant". |
| contactList | array | Yes | Names of contact lists to send messages to your contacts. You can include "unassigned" to target contacts that don't belong to any contact list. Note: This is required if broadcastType is "broadcast". |
| templateName | string | No | Name of the template you want to send. Note: This is required if messageType is "template". |
| 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. |
| urlVariables | array | No | Specify path variables or query parameters you want to concatenate in the URL. This is only used if messageType is "template" and the template has Dynamic URL CTA Buttons. |
| copyCodeParam | string | No |  |
| scheduleAt | string | No | Specify when you want this broadcast to be delivered to recipients. E.g. "2025-03-13T04:20:14.007Z" Note: This is required if status is "scheduled". |
| copyCode | string | No | Code to send with the template, includes a copy code button. |
| regularMessageType | string | No | Type of message you want to send, this must be "text", "image", "audio", "video", or "document". Note: This is required if messageType is "regular". |
| message | string | No | The message field is required as a non-empty string if regularMessageType is "text". |
| link | string | No | The link field is required as a valid URL if you want to send a media message. |
| filename | string | No | The filename field is only used if you want to send a document-type message. |
| caption | string | No | The caption field is only used if you want to send a media message except for an audio message. |

**Example request body:**

```json
{
  "name": "summer_promo",
  "broadcastType": "broadcast",
  "messageType": "template",
  "status": "instant",
  "contactList": ["sups"],
  "templateName": "summer_time",
  "headerParams": ["Hi John"],
  "bodyParams": ["Summer", "25%"],
  "urlVariables": ["?tab=summer_zone"],
  "copyCodeParam": "LGBTQ++"
}
```

**Response (200)** — Success Response:

```json
{
    "status": "success",
    "message": "Broadcast created successfully",
    "data": {
        "name": "summer_promo",
        "messageType": "template",
        "broadcastType": "broadcast",
        "templateName": "summer_time",
        "bodyParams": [
            "Summer",
            "25%"
        ],
        "headerParams": [
            "Hi John"
        ],
        "status": "live",
        "contactList": [
            "sups"
        ],
        "_id": "67d164798873ae03XXXXXXXX",
        "createdAt": "2025-03-12T10:39:53.298Z",
        "updatedAt": "2025-03-12T10:39:53.298Z",
        "startedAt": "2025-03-12T10:39:53.299Z",
        "__v": 0
    }
}
```

**Code examples:**

_cURL_

```curl
curl -X POST https://chatflow.pabbly.com/api/v1/broadcasts \
  -H "Authorization: Bearer {{YOUR_API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "summer_promo",
    "broadcastType": "broadcast",
    "messageType": "template",
    "status": "instant",
    "contactList": [
      "sups"
    ],
    "templateName": "summer_time",
    "headerParams": [
      "Hi John"
    ],
    "bodyParams": [
      "Summer",
      "25%"
    ],
    "urlVariables": [
      "?tab=summer_zone"
    ],
    "copyCodeParam": "LGBTQ++"
  }'
```

_Ruby_

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

uri = URI('https://chatflow.pabbly.com/api/v1/broadcasts')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer {{YOUR_API_KEY}}'
request['Content-Type'] = 'application/json'
request.body = "{\"name\":\"summer_promo\",\"broadcastType\":\"broadcast\",\"messageType\":\"template\",\"status\":\"instant\",\"contactList\":[\"sups\"],\"templateName\":\"summer_time\",\"headerParams\":[\"Hi John\"],\"bodyParams\":[\"Summer\",\"25%\"],\"urlVariables\":[\"?tab=summer_zone\"],\"copyCodeParam\":\"LGBTQ++\"}"

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',
    headers={'Authorization': 'Bearer {{YOUR_API_KEY}}'},
    json={
    'name': 'summer_promo',
    'broadcastType': 'broadcast',
    'messageType': 'template',
    'status': 'instant',
    'contactList': [
        'sups'
    ],
    'templateName': 'summer_time',
    'headerParams': [
        'Hi John'
    ],
    'bodyParams': [
        'Summer',
        '25%'
    ],
    'urlVariables': [
        '?tab=summer_zone'
    ],
    'copyCodeParam': 'LGBTQ++'
},
)

data = response.json()
```

_PHP_

```php
<?php
$ch = curl_init('https://chatflow.pabbly.com/api/v1/broadcasts');
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, '{"name":"summer_promo","broadcastType":"broadcast","messageType":"template","status":"instant","contactList":["sups"],"templateName":"summer_time","headerParams":["Hi John"],"bodyParams":["Summer","25%"],"urlVariables":["?tab=summer_zone"],"copyCodeParam":"LGBTQ++"}');

$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"))
    .header("Authorization", "Bearer {{YOUR_API_KEY}}")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\"name\":\"summer_promo\",\"broadcastType\":\"broadcast\",\"messageType\":\"template\",\"status\":\"instant\",\"contactList\":[\"sups\"],\"templateName\":\"summer_time\",\"headerParams\":[\"Hi John\"],\"bodyParams\":[\"Summer\",\"25%\"],\"urlVariables\":[\"?tab=summer_zone\"],\"copyCodeParam\":\"LGBTQ++\"}"));

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', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer {{YOUR_API_KEY}}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "summer_promo",
    "broadcastType": "broadcast",
    "messageType": "template",
    "status": "instant",
    "contactList": [
      "sups"
    ],
    "templateName": "summer_time",
    "headerParams": [
      "Hi John"
    ],
    "bodyParams": [
      "Summer",
      "25%"
    ],
    "urlVariables": [
      "?tab=summer_zone"
    ],
    "copyCodeParam": "LGBTQ++"
  }),
});

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

_Go_

```go
package main

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

func main() {
    payload := strings.NewReader("{\"name\":\"summer_promo\",\"broadcastType\":\"broadcast\",\"messageType\":\"template\",\"status\":\"instant\",\"contactList\":[\"sups\"],\"templateName\":\"summer_time\",\"headerParams\":[\"Hi John\"],\"bodyParams\":[\"Summer\",\"25%\"],\"urlVariables\":[\"?tab=summer_zone\"],\"copyCodeParam\":\"LGBTQ++\"}")
    req, _ := http.NewRequest("POST", "https://chatflow.pabbly.com/api/v1/broadcasts", 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");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer {{YOUR_API_KEY}}");
request.Content = new StringContent("{\"name\":\"summer_promo\",\"broadcastType\":\"broadcast\",\"messageType\":\"template\",\"status\":\"instant\",\"contactList\":[\"sups\"],\"templateName\":\"summer_time\",\"headerParams\":[\"Hi John\"],\"bodyParams\":[\"Summer\",\"25%\"],\"urlVariables\":[\"?tab=summer_zone\"],\"copyCodeParam\":\"LGBTQ++\"}");
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 — Add API Campaign](/chatflow/broadcasts/add-api-campaign)
- [POST /broadcasts/send — Send API Campaign](/chatflow/broadcasts/send-api-campaign)

