NAV Navbar
shell php

Introduction

Welcome to the WAPLUGIN API! You can use our API to access WAPLUGIN API endpoints, which can get information on accounts, contacts and send WhatsApp message.

We have language bindings in Shell, and PHP! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

To authorize, use this code:

# With shell, you can just pass the correct header with each request
curl "api_endpoint_here"
  -H "Authorization: Bearer YOUR_API_KEY"

Make sure to replace YOUR_API_KEY with your API key.

WAPLUGIN uses API keys to allow access to the API. You can register a new WAPLUGIN API key at our developer portal.

WAPLUGIN expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Bearer YOUR_API_KEY

Accounts

You can get all the list of your WhatsApp accounts that are connected to our system.

Get All Accounts

curl --request GET \
  --url https://waplugin.com/api/account/ \
  --header 'Authorization: Bearer YOUR_API_KEY'
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://waplugin.com/api/account/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOUR_API_KEY"
  ),
));

$response = curl_exec($curl);
curl_close($curl);

return $response;

The above command returns JSON structured like this:

{
    "code": 200,
    "status": "success",
    "results": {
        "current_page": 1,
        "data": [
            {
                "id": 3,
                "user_id": 1,
                "name": "CS TEAM",
                "active": 1,
                "connected": 0,
                "actived_at": "2019-11-14 18:27:21",
                "expired_at": "2019-12-14 18:27:21",
                "created_at": "2019-11-14 18:27:21",
                "updated_at": "2019-11-14 18:27:21"
            },
            {
                "id": 1,
                "user_id": 1,
                "name": "SUPPORT TEAM",
                "active": 0,
                "connected": 0,
                "actived_at": "2019-10-27 16:00:16",
                "expired_at": "2019-10-27 16:00:16",
                "created_at": "2019-11-03 16:00:16",
                "updated_at": "2019-10-27 18:41:15"
            },
            {
                "id": 2,
                "user_id": 1,
                "name": "OWNER TEAM",
                "active": 1,
                "connected": 0,
                "actived_at": "2019-10-27 16:53:06",
                "expired_at": "2019-11-27 16:53:06",
                "created_at": "2019-10-27 16:53:06",
                "updated_at": "2019-11-16 21:54:11"
            }
        ],
        "first_page_url": "https://waplugin.com/api/account?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "https://waplugin.com/api/account?page=1",
        "next_page_url": null,
        "path": "https://waplugin.com/api/account",
        "per_page": 10,
        "prev_page_url": null,
        "to": 3,
        "total": 3
    }
}

This endpoint retrieves all accounts.

HTTP Request

GET https://waplugin.com/api/account

Query Parameters

Parameter Type Mandatory Description
page Boolean No Page for pagination

Get a Specific Accounts

curl --request GET \
  --url https://waplugin.com/api/account/1 \
  --header 'Authorization: Bearer YOUR_API_KEY'
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://waplugin.com/api/account/1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOUR_API_KEY"
  ),
));

$response = curl_exec($curl);
curl_close($curl);

return $response;

The above command returns JSON structured like this:

{
    "code": 200,
    "status": "success",
    "results": {
        "id": 1,
        "user_id": 1,
        "name": "Pribadi",
        "active": 0,
        "connected": 0,
        "actived_at": "2019-10-27 16:00:16",
        "expired_at": "2019-10-27 16:00:16",
        "created_at": "2019-11-03 16:00:16",
        "updated_at": "2019-10-27 18:41:15"
    }
}

This endpoint retrieves a specific account.

HTTP Request

GET https://waplugin.com/api/account/<ID>

URL Parameters

Parameter Description
ID The ID of the account to retrieve

WhatsApp

You can check login status or phone connected or not and send message with this API.

WhatsApp Status

curl --request GET \
  --url https://waplugin.com/api/wa/is-connected/1 \
  --header 'Authorization: Bearer YOUR_API_KEY'
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://waplugin.com/api/wa/is-connected/1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOUR_API_KEY"
  ),
));

$response = curl_exec($curl);
curl_close($curl);

return $response;

The above command returns JSON structured like this:

{
    "Success": true
}

This endpoint retrieves a WhatsApp account login status.

HTTP Request

GET https://waplugin.com/api/wa/is-connected/<ID>

URL Parameters

Parameter Description
ID Account ID

Send Message

curl --request POST \
  --url https://waplugin.com/api/wa/send-message/1 \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'phone=6281xxxxx&msg=Test'
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://waplugin.com/api/wa/send-message/1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "phone=6281xxxxx&msg=Test",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOUR_API_KEY"
  ),
));

$response = curl_exec($curl);
curl_close($curl);

return $response;

The above command returns JSON structured like this:

{
    "Success": true
}

This endpoint will send a WhatsApp message.

HTTP Request

POST https://waplugin.com/api/wa/send-message/<ID>

URL Parameters

Parameter Description
ID Account ID

POST Data

Field Description
phone Phone Number
msg Message

Phone number format

For phone number format, please refer to This Format