Skip to content

Send Email Broadcast

The Broadcast Endpoint API allows you create, send and manage broadcasts on your integration.

Send Email

Post
bash
https://api.bunce.so/v1/broadcast/send/email

Send Email

If successful, your response includes a message that your broadcast has been sent successfully. If there is an error with any of the parameters, it will return a 422 HTTP status code with details in an error object.

Request

Body Parameters required

sender_email string<email> requiredSender Email
sender_name string<email> requiredSender Name
email string<email> requiredRecipient Email
subject string requiredMessage Subject
cc array [] optionalArray containing emails to copy
bcc array [] optionalArray containing emails to blind copy
reply_to array [] optionalArray containing emails to reply to
message string requiredBroadcast Content
message_type string requiredMessage Type
all_customers boloean optionalAdd this option to send message to all customers
recipients array optionalRecipient array. Required if all_customers key is not present in the request or is false. Possible values for type
customer segment
schedule_type string requiredBroadcast Schedule type. Possible values for type
send-now send-later
schedule_date array [ schedule_date: date; timezone: string; ] optionalRequired if schedule type is send-later

Recipients

The recipients field is an array that is required if all_customer is not sent in the payload or if all_customers is set to false . Each recipient object should contain the following fields:

FieldDescription
type string requiredThe type of recipient. Accepted values are customer and segment.
customers array required if recipient type is customer
  • customer_id string required if email is not present
  • email email required if customer_id is not present
  • first_name string optional
  • last_name string optional
  • phone_no string optional
segments array required if recipient type is segmentarray containing segment ids

A new customer record will be created for the customer object passed or updated if the customer email or customer_id already exist.

bash
curl --request POST \
  --url https://api.bunce.so/v1/braodacast/send/email \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: sk_live_************************' \
  --data '{
    "subject" : "Broadcast Test",
    "message" : "This is a test broadcast message",
    "sender_email": "test@rabigarba.site",
    "sender_name": "imoh",
    "email" : "su.imohita@gmail.com",
    "message_type" : "otp",
    "recipients": {
        "type" : "customer",
        "customers": [
            {
                "customer_id": "934273498234",
                "first_name": "Rita",
                "last_name": "Basset",
                "phone_no": "+234944874874",
                "email": "email1@gmail.com"
            },
            {
                "customer_id": "672346FG",
                "first_name": "John",
                "last_name": "Doe",
                "phone_no": "+2348106489348",
                "email": "email2@gmail.com"
            }
        ]
    },
    "schedule_type": "send-now"
}'
go
package main

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

func main() {

	url := "http://api.bunce.so/v1/broadcast/send/email"


  payload := strings.NewReader("{\n    \"subject\" : \"Broadcast Test\",\n    \"message\" : \"This is a test broadcast message\",\n    \"sender_email\": \"test@rabigarba.site\",\n    \"sender_name\": \"imoh\",\n    \"email\" : \"su.imohita@gmail.com\",\n    \"message_type\" : \"otp\",\n    \"all_customers\": true,\n    \"schedule_type\": \"send-now\"\n}")


	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Authorization", "sk_live_************************")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
js
const  = {
  : 'POST',
  : {
    'X-Authorization': 'sk_live_************************',
    'Content-Type': 'application/json',
  },
  : '{"subject":"Broadcast Test","message":"This is a test broadcast message","sender_email":"test@rabigarba.site","sender_name":"imoh","email":"su.imohita@gmail.com","message_type":"otp","all_customers":true,"schedule_type":"send-now"}',
}

('https://api.bunce.so/v1/broadcast/send/email', )
  .(() => .())
  .(() => .())
  .(() => .())
php
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
    "subject" : "Broadcast Test",
    "message" : "This is a test broadcast message",
    "sender_email": "test@rabigarba.site",
    "sender_name": "imoh",
    "email" : "su.imohita@gmail.com",
    "message_type" : "otp",
    "recipients": {
        "type" : "customer",
        "customers": [
            {
                "customer_id": "934273498234",
                "first_name": "Rita",
                "last_name": "Basset",
                "phone_no": "+234944874874",
                "email": "email1@gmail.com"
            },
            {
                "customer_id": "672346FG",
                "first_name": "John",
                "last_name": "Doe",
                "phone_no": "+2348106489348",
                "email": "email2@gmail.com"
            }
        ]
    },
    "schedule_type": "send-now"
}');

$request->setRequestUrl('https://api.bunce.so/v1/broadcast/send/email');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'X-Authorization' => 'sk_live_************************',
  'Content-Type' => 'application/json'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
java
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.bunce.so/v1/broadcast/send/email"))
    .header("X-Authorization", "sk_live_************************")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n    \"subject\" : \"Broadcast Test\",\n    \"message\" : \"This is a test broadcast message\",\n    \"sender_email\": \"test@rabigarba.site\",\n    \"sender_name\": \"imoh\",\n    \"email\" : \"su.imohita@gmail.com\",\n    \"message_type\" : \"otp\",\n    \"all_customers\": true,\n    \"schedule_type\": \"send-now\"\n}"))
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

Response

json
{
  "success": true,
  "data": null,
  "message": "Email Broadcast sent successfully"
}