API Documentation

To integrate WhatsApp messaging in website or application, we offer two choices,

1- WhatsApp Managed by us.
2- Whatsapp Managed by you.

Lets explore them,



1- WhatsApp Managed by us

We also call this service as "Cloud Service". It means, you just need to Login > Scan QR Code > Start sending messages.
You can find "Cloud Services" tab on Dashboard after login. Just start the services and wait for the QR Code to apear. After scanning the QR Code you are ready to go.

Features: Sent Text, Multimedia, PDF, Files etc. Moreover, this method also supports Auto responder / ChatBot without any coding.

STEP 01: Create an account / Login to get User ID and API Key.

STEP 02: Start Cloud Service after login and scan QR code with your WhatsApp.

STEP 03: Download and Include the given PHP class ( WhatsappAPI.php ) in your application or follow the given example bellow.

Warning: While using our API, your own WhatsApp number will be used, in case of sending multiple messages, you can get your number blocked by WhatsApp as WhatsApp does not allow the spamming, please read our and WhatsApp's terms and conditions. We are providing unofficial solution and our role is as bridge between you and the Whatsapp. We are not responsible for any damage to your Hardware/Software/Service etc.

Always put some random delay between the messages if you sending multiple messages and make sure that people also reply you back when sending messages to them. It helps sometime in avoidance of getting mumber banned by WhatsApp BUT NOT GUARANTEED.

Example PHP Code to send Whatsapp message by making example.php:


<?php

  /*
  This example works only for those users which are using Cloud Service and do not want to run
  client application on their end.

  You just need to Start the Cloud Service from the Dashboard and Scan QR Code.
  When WhatsApp gets ready, then you can start sending messages.
  */

  include('WhatsappAPI.php'); // include given API file


  $wp = new WhatsappAPI("123", "your_api_key_here"); // create an object of the WhatsappAPI class with your user id and api key

  $number = '+123456789'; // NOTE: Phone Number should be with country code
  $message = 'Hello World'; // You can use WhatsApp Code to compose text messages like *bold*, ~Strikethrough~, ```Monospace```
  $media_url = 'http://www.africau.edu/images/default/sample.pdf'; // Direct global accessible URL of the file, image, docs etc.
  // Max file size should be 10MB otherwise you may get error.
  $group = '123456789-123456789@g.us'; // After login, your can get Group IDs against your group names from our Support Team.
  $caption = 'Its my Caption'; // For media files


  // Send Text Message to number
  $status = $wp->sendText($number, $message);

  // Send PDF, Documents, File, Images etc  Message to number
  $status = $wp->sendFromURL($number, $media_url, $caption);

  // Send Text message in Group
  $status = $wp->sendTextInGroup($group, $message);

  // Send Media message in Group
  $status = $wp->sendFromURLInGroup($group, $media_url, $caption);

  $status = json_decode($status);

  print_r($status);
  
    //Expected API Responses
  
  // {"status":200,"message":"WhatsApp chat has been queued for sending!","data":false}
  // {"status":400,"message":"Invalid phone number!","data":false}
    
  // {"status":500,"error":"WhatsApp account doesn't exist!"}
  // {"status":500,"error":"Unable to connect to WhatsApp Servers!"}
    
  // {'status': 'error': 'response': 'Required variables are missing in your POST request or number seems invalid.'}
  // {"status":"error","response":"Invalid Credentials"}
  // {'status': 'error': 'response': 'Client ID or Key is missing'}
  

?>
                                

Related video tutorials

You can send POST requests on following urls with your ID and API Key for different operations.

  1. Send Simple Text Message

    URL
    https://onyxberry.com/services/wapi/api2/sendtext/your_id/your_api_key

    POST Request Data

    number | Required
    message | Required

    Returns

    Success
    Error

  2. Send Images/PDF/Documents etc from URL

    URL
    https://onyxberry.com/services/wapi/api2/sendFromURL/your_id/your_api_key

    POST Request Data

    number | Required
    url | Required
    caption | Optional

    Returns

    Success
    Error

  3. Send Text message in Group

    URL
    https://onyxberry.com/services/wapi/api2/sendTextInGroup/your_id/your_api_key

    POST Request Data

    groupName | Required
    message | Required

    Returns

    Success
    Error

  4. Send Images/PDF/Documents etc from URL in Group

    URL
    https://onyxberry.com/services/wapi/api2/sendFromURLInGroup/your_id/your_api_key

    POST Request Data

    groupName | Required
    url | Required
    caption | Optional

    Returns

    Success
    Error

  5. Check number is Registered with WhatsApp or not

    URL
    https://onyxberry.com/services/wapi/api2/isRegisteredUser/your_id/your_api_key

    POST Request Data

    number | Required

    Returns

    Success
    Error

Elevate your communication strategy with the WhatsApp Messaging plugin for WordPress. Seamlessly integrate WhatsApp messaging into your website to engage with your audience in real-time. Whether it's contact form submissions or new WooCommerce orders, this plugin ensures that you never miss an opportunity to connect.

Key Features:

1. Contact Form Integration:

Easily configure the plugin to send WhatsApp messages whenever a user submits a contact form on your website. Streamline communication and respond promptly to inquiries.

2. WooCommerce Order Notifications:

Enhance customer satisfaction by receiving instant WhatsApp notifications for new WooCommerce orders. Keep your team informed and improve order processing efficiency.

3. Customizable Messages:

Tailor your WhatsApp messages to suit your brand's voice. Customize the content of your messages to provide a personalized experience for your users.

4. Simple Configuration:

The plugin offers a user-friendly settings page where you can effortlessly set up your WhatsApp API credentials. No complex configurations – get started with just a few clicks.

5. Testing Functionality:

Verify the effectiveness of your WhatsApp messaging setup with the built-in testing feature. Send test messages to ensure that your audience receives the right information at the right time.

6. Enable/Disable Messaging:

Have full control over when and where your WhatsApp messages are sent. Enable or disable messaging for orders and contact forms based on your business requirements.

7. Secure API Integration:

Rest easy knowing that your WhatsApp API credentials are handled securely. The plugin ensures a reliable and secure connection between your WordPress website and the WhatsApp messaging service.

8. Regular Updates and Support:

Stay up-to-date with the latest features and improvements. Benefit from ongoing support to address any queries or concerns you may have.

Enhance your website's functionality and elevate user engagement with the WhatsApp Messaging plugin. Connect with your audience on a more personal level, driving better communication and ultimately, greater satisfaction. Install the plugin today and unlock the power of seamless WhatsApp integration on your WordPress site.

Download Plugin

Onxy Messaging is a powerful Node.js module that simplifies the process of sending WhatsApp messages through a third-party API. Whether you need to send simple text messages, media files from URLs, or messages within WhatsApp groups, Onxy Messaging provides a convenient and easy-to-use interface.

Features

  • Send Simple Text Messages: Effortlessly send plain text messages to any WhatsApp number.
  • Media Sharing: Share images, PDFs, documents, and more by providing the URL of the media file.
  • Group Messaging: Send text messages or media content to WhatsApp groups seamlessly.

Getting Started

  1. Install the module using npm:
npm install onxy-messaging
  1. Create an instance of the OnxyMessaging class, providing your WhatsApp ID and API key.
  2. Use the provided methods to send messages and media effortlessly.

Usage Example:


const OnxyMessaging = require('onxy-messaging');

const yourId = 'your_id'; // get this info by login on onyxberry.com/services/wapi
const apiKey = 'your_api_key';

const onxy = new OnxyMessaging(yourId, apiKey);

// Example: Sending a simple text message
onxy.sendSimpleTextMessage('recipient_number', 'Hello, this is a test message')
  .then(response => console.log(response))
  .catch(error => console.error(error));

// Other methods:
// - onxy.sendMediaFromURL('recipient_number', 'media_url', 'Optional caption')
// - onxy.sendTextInGroup('group_name', 'message')
// - onxy.sendMediaFromURLInGroup('group_name', 'media_url', 'Optional caption')

    
You can also use
pip3 install whatsapp-api
Or directly copy in your code.

import requests

BASE_URL = 'https://onyxberry.com/services/wapi/api2'

class WhatsAppAPI:
    def __init__(self, your_id, api_key):
        self.your_id = your_id
        self.api_key = api_key

    def send_simple_text_message(self, number, message):
        url = f'{BASE_URL}/sendtext/{self.your_id}/{self.api_key}'
        data = {'number': number, 'message': message}

        response = requests.post(url, data=data)
        return response.json()

    def send_media_from_url(self, number, url, caption=''):
        url = f'{BASE_URL}/sendFromURL/{self.your_id}/{self.api_key}'
        data = {'number': number, 'url': url, 'caption': caption}

        response = requests.post(url, data=data)
        return response.json()

    def send_text_in_group(self, group_name, message):
        url = f'{BASE_URL}/sendTextInGroup/{self.your_id}/{self.api_key}'
        data = {'groupName': group_name, 'message': message}

        response = requests.post(url, data=data)
        return response.json()

    def send_media_from_url_in_group(self, group_name, url, caption=''):
        url = f'{BASE_URL}/sendFromURLInGroup/{self.your_id}/{self.api_key}'
        data = {'groupName': group_name, 'url': url, 'caption': caption}

        response = requests.post(url, data=data)
        return response.json()

# Example usage
if __name__ == "__main__":
    your_id = 'your_id'
    api_key = 'your_api_key'

    whatsapp = WhatsAppAPI(your_id, api_key)

    # Sending a simple text message
    result = whatsapp.send_simple_text_message('recipient_number', 'Hello, this is a test message')
    print(result)

    # Sending media from URL
    result = whatsapp.send_media_from_url('recipient_number', 'media_url', 'Optional caption')
    print(result)

    # Sending text in a group
    result = whatsapp.send_text_in_group('group_name', 'Hello, this is a group message')
    print(result)

    # Sending media in a group from URL
    result = whatsapp.send_media_from_url_in_group('group_name', 'media_url', 'Optional caption')
    print(result)

                                        


2- WhatsApp Managed by you

It means, to start sending WhatsApp messages, you need to download and run our given Client Application on your computer to get your messages delivered.

Features: Text Messages Only

STEP 01: Create an account / Login to get User ID and API Key.

STEP 02: Download, extract and Run the Onyx WhatsApp Client application for Windows to send WhatsApp messages by Google Chrome.

STEP 03: Download and Include the given PHP class in your application or follow the given example bellow.

Warning: While using our API, your own WhatsApp number will be used, in case of sending multiple messages, you can get your number blocked by WhatsApp as WhatsApp does not allow the spamming, please read our and WhatsApp's terms and conditions. We are providing unofficial solution and our role is as bridge between you and the Whatsapp. We are not responsible for any damage to your Hardware/Software/Service etc.

Always put some random delay between the messages if you sending multiple messages and make sure that people also reply you back when sending messages to them. It helps sometime in avoidance of getting mumber banned by WhatsApp BUT NOT GUARANTEED.

Example PHP Code to send Whatsapp message by making example.php:


      <?php
          include('WhatsappAPI.php'); // include given API class 

          $obj = new WhatsappAPI('1234', 'your_api_key'); // create object by passing your User ID and API Key
          $status = $obj->send("+97123456789", "Hello World"); // NOTE: Phone Number should be with country code
          $status = json_decode($status);
          print_r($status);
      ?>
                              

JSON Response Codes


      Success:
          {'code' =>200, 'msg' => 'Successfully saved'}

      Error:
          {'code' => 100, 'msg' => 'Error in saving'}

      Username or Key Error:
          {'code' => 300, 'msg' => 'Username or Key error!!'}
                          

Related video tutorials


STEP 01: Create an account to get User ID and API Key.
STEP 02: Download, extract and run the Onyx WhatsApp Client application for Windows(x64 bit) to send WhatsApp messages by Google Chrome.
STEP 03:  Copy and past following function in your code.


      	var HttpClient = function() {
              const user_id = 123;			 // Replace with your User ID
              const api_key = 'Put your api key here';  // Replace with your API Key

              this.send = function(to, message, aCallback) {
              var anHttpRequest = new XMLHttpRequest();
              anHttpRequest.onreadystatechange = function() {
                  if (anHttpRequest.readyState == 4 && anHttpRequest.status == 200)
                      aCallback(anHttpRequest.responseText);
              }

      	data = new FormData()
      	data.set('to', to)
      	data.set('msg', message)

      	aUrl = "https://onyxberry.com/services/wapi/client/sendMessage/" + user_id + "/" + api_key;

              anHttpRequest.open( "POST", aUrl, true );
              anHttpRequest.send(data);
          }
      }
      			

STEP 04: Call the function when you required to send WhatsApp message.


      // Implementation

      var whatsapp = new HttpClient();

          whatsapp.send('+12345678999', 'Hello World', function(response) { // Phone number should be with country code
            // do something with response 
      	response = JSON.parse(response);
      	console.log(response.msg);
      });
      		

JSON Response Codes

Success:
{'code' => 200, 'msg' => 'Successfully saved'}

Error:
{'code' => 100, 'msg' => 'Error in saving'}

Username or Key Error:
{'code' => 300, 'msg' => 'Username or Key error!!'}