PAY HERO DOCS
  • Introduction-Pay Hero Developer APIs
  • Creating Account
  • Authorization
  • GET: Service Wallet Balance
  • GET: Payments Wallet Balance
  • POST: Service Wallet Top Up
  • POST: Initiate MPESA STK Push Request
  • Payment Button
  • Lipwa Link
  • POST: Pay Hero Wallet- Withdraw To Mobile
  • GET: Account Transactions
  • GET: Transaction Status
  • WooCommerce Plugin
    • Plugin Installation
  • Shopify
  • Videos
  • Other Integrations
  • Email API Reference
    • Register SMTP
    • Send Email
    • Mail status
  • WhatsApp API Reference
    • Introduction
    • Getting Started
    • Send API Whats App Text
    • Bulk WhatsApp API Messaging
    • Bulk WhatsApp Using UI/CSV File
Powered by GitBook
On this page
  • Send Bulk Messages
  • Sample Code

Was this helpful?

  1. WhatsApp API Reference

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

Name
Value

Content-Type

application/json

Authorization

Basic <token>

Body

Name
Type
Description

message_type

string

Either : TEXT, IMAGE or DOCUMENT

session

string

Your Session name, 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
}
{
  "error": "Invalid request"
}

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;
?>
PreviousSend API Whats App TextNextBulk WhatsApp Using UI/CSV File

Last updated 3 months ago

Was this helpful?

 [
    {
      "name": "Name",
      "phone_number": "+254700000000",
      "message": "Test *Bulk* WhatsApp message from admin portal",
      "document_url": "https://payherokenya.com/wp-content/uploads/2024/03/cropped-PayHero1.png"
    },
    {
      "name": "Name 2",
      "phone_number": "+254788888888",
      "message": "Test *Bulk* WhatsApp message from admin portal",
      "document_url": "https://payherokenya.com/wp-content/uploads/2024/03/cropped-PayHero1.png"
    }
  ]