Bulk WhatsApp API Messaging

This API enables you to send multi media messages to several recipients on WhatsApp at once

With this API you can send TEXT, IMAGE OR DOCUMENT messages easily and quickly to multiple recipients at once.

Lets get started

Send Bulk Messages

POST https://backend.payhero.co.ke/api/v2/whatspp/sendBulk

Send TEXT, IMAGE Or DOCUMENT messages easily and quickly to multiple recipients.

Headers

NameValue

Content-Type

application/json

Authorization

Basic <token>

Body

NameTypeDescription

message_type

string

Either : TEXT, IMAGE or DOCUMENT

session

string

Your API username, that you used to register the session.

message

string

The message you want to send.

document_url

string

Optional, the document URL incase you are sending image or document

recipients

object

An object containing all the recipients you want to message eg:

Response

{
    "success": true
}

Sample Code

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://backend.payhero.co.ke/api/v2/whatspp/sendBulk',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
  "message_type": "TEXT",
  "session": "sessionaName",
  "message": "message",
  "document_url": "https://payherokenya.com/wp-content/uploads/2024/03/cropped-PayHero1.png",
  "recipients": [
    {
      "name": "Name1",
      "phone_number": "+254700000000",
      "message": "Test *Bulk* WhatsApp message",
      "document_url": "https://payherokenya.com/wp-content/uploads/2024/03/cropped-PayHero1.png"
    },
    {
      "name": "Name2",
      "phone_number": "+254711111111",
      "message": "Test *Bulk* WhatsApp message",
      "document_url": "https://payherokenya.com/wp-content/uploads/2024/03/cropped-PayHero1.png"
    },
    {
      "name": "Name3",
      "phone_number": "+254333333333",
      "message": "Test *Bulk* WhatsApp message",
      "document_url": "https://payherokenya.com/wp-content/uploads/2024/03/cropped-PayHero1.png"
    }
  ]
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic ZXYwOUJpel'
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>

Last updated