Skip to content

Sending WhatsApp Message Using PHP for Merciglobal Cloud ERP

This guide explains how to send a WhatsApp message programmatically using PHP for integrations with Merciglobal Cloud ERP.

Prerequisites

Before you proceed, ensure:

  • You have a registered account with a WhatsApp messaging API provider like whatapi.in
  • You have a valid WEBHOOK ID
  • PHP environment is set up on your server
  • Your server is connected to the internet

PHP Code to Send WhatsApp Message

Place the following code snippet inside your PHP script:

<?php
   // Replace this with your target mobile number
   $mobile = '91xxxxxxxxxx';

   // Create your message
   $reply = "Testing Whatsapp messaging:" . PHP_EOL . PHP_EOL . 'Thank You' . PHP_EOL . 'Team Merciglobal';

   // URL encode the message
   $reply = urlencode($reply);

   // Construct the webhook URL with your Webhook ID
   $url = "https://webhooks.whatapi.in/webhook/{WEBHOOKID}?number=$mobile&msg=$reply";

   // Assuming wbot is a class that handles sending HTTP requests
   $bot = new wbot();
   $bot->send($url);
?>

Replace Placeholders

Placeholder Replace With
91xxxxxxxxxx Your recipient's mobile number
{WEBHOOKID} Your actual webhook ID from API

Notes

  • Always use urlencode() to avoid formatting issues in your message.
  • Make sure your class wbot has the method send() which can execute an HTTP GET request.
  • This integration is useful for sending automated updates from Merciglobal Cloud ERP such as invoices, reminders, and alerts.

Security Tip

Avoid hardcoding sensitive data like Webhook IDs. Consider storing them in environment variables or secured config files.


Support

For any assistance with integrating this feature into Merciglobal Cloud ERP, please contact the Merci Developer Team or reach out to support@merciglobal.com.


Happy Messaging 🚀

MerciGlobal ERP Team