Maytapi WhatsApp
PAID
By maytapi
Updated 9 days ago
Maytapi WhatsApp Overview
Send and receive messages from WhatsApp via Maytapi. It is a stable and reliable solution. See more: https://maytapi.com/
provider
rating
Followers on API
Follow this API
resourcesProvider WebsiteTerms of Service
More Details

MAYTAPI WHATSAPP API

Introduction

This API deals with a chatting platform based on WhatsApp. With the endpoints that are created for the user, the user can send and receive text and media messages through WhatsApp in private chats. Moreover, the current status and the screen of the session can be retrieved using these endpoints. With the account specific endpoints, user can get the product or registered phones information, edit and remove these. Currently the API allows you to add a specific determined number of phones into one account regarding your purchase package.

What is Webhook?

It is an address, to which all the acknowledge information of the sent messages and all the received messages are delivered. It is specified by the user.

Session Information Getters

GET screen

Returns the screenshot of the screen in the current session.

  • Body : -
  • Successful response : screenshot of the WhatsApp screen

GET status

Returns the status of the current session.

  • Body : -
  • Successful Response :
{
    "success": true,
    "status": {
        "loggedIn": true/false,     
        "isQr": true/false, 
        "loading": true/false,
        "connRetry": true/false,
        "message": "..."
    }
}

The status parameters are:

STATES MEANINGS
loggedIn if the qr-screen is also passed and the chat screen is opened
isQr if the session is in qr-screen
loading if the session is loading before the qr-screen or after passes qr-screen
connRetry if the internet connection is not available and page is refreshed
message specific message from Whatsapp about the status

GET qrCode

Gets the image of qr-code.

  • Body : -
  • Successful Response : qr-code image itself

Session Controlling Operations

POST restart

Restarts the session by refreshing the page.

  • Body : -
  • Successful response :
{
        "success": true
}

POST backup

Backups the material needed for opening the same chat screen for the current phone number. This call is useful when the
session is active and also the status of the session is active. Later, the response information can be used to open
the chat screen with the POST restore call.

  • Body : -
  • Successful response :
{
        "success": true,
        "data": {
            (all the current session information)
        }
}

POST restore

Reloads the current session based on the reload data.

  • Body : all the Whatsapp local storage data needed, can be obtained by calling POST backup, when session is open and status is active.
{
    "WABrowserId": "...",
   "debugCursor": "...",
    "remember-me": "...",
    "whatsapp-mutex": "..."
}
  • Successful response :
{
        "success": true
}

POST logout

Logouts the number from the current session and converts the screen to qr-code screen.

  • Body : -
  • Successful response :
{
        "success": true
}

Message Sending Operations

POST sendMessage

Sends both text and media (image, video, sound, document) to the user, whose number is taken at the body of the request.

  • Body :
{
    "to_number": "...",
    "message": "...",
    "type" : "text" / "media"
}
PARAMETES USAGE
to_number with the country code excluding + , e.g. 905001112233 for Turkey
type if a text message is sent, then type is text, for other types the type parameter is media
message if the message is a text message, then the message itself, if the message is a media message, then either the direct web link of the media or if the media is an image under 1MB, then its base64 text can be also given.
  • Successful response :
{
    "success": true,
    "data": {
        "chatId": "...",
        "msgId": "..."
    } 
}
PARAMETES USAGE
chatId the specific id of the chat the message is sent to
msgId the specific id of the message sent (can be useful for matching with the acknowledgement notifications)

Account Information Retrieval

GET product

Gets the product id and webhook url of the account.

  • Body : -
  • Successful Response :
{
    "pid": "...", 
    "webhook": "...",
    "ack_delivery": 0 / 1, 
    "phone_limit": ...
}
PARAMETES USAGE
pid product id of the account
webhook webhook url of the account, the incoming messages and acknowledge messages are directed there
ack_delivery 0, if the acknowledge message delivery is not enabled; 1, otherwise

GET listPhones

Gets the list of phones with their id's and numbers that are registered to the given product id.

  • Body : -
  • Successful Response :
[
    {
        "id": ...,
        "number": "..."
    },
    {
        "id": ...,
        "number": "..."
    },
    ...
]
PARAMETES USAGE
id id of the phone object assigned by the database automatically
number the number registered for the specific id

POST setWebhook

Sets the webhook url. Webhook is used for directing the incoming messages and some changes in the session.

  • Body :
{
    "webhook": "..."
}
  • Successful Response : returns the current product's information.
{
    "pid": "...",
    "webhook": "...",
    "ack_delivery": 0 / 1, 
    "phone_limit": ...
}

POST addPhone

Adds a new phone object to the database for the product determined by the taken product id. A number can also be specified in that step but if not, the phone number in the active session after the qr-screen process is entered to the database.

  • Body : (optional)
{
    "number": "..."
}

** Successful Response: returns the current phone object.

{
    "id": ...,
    "pid": "...",
    "number": ...
}

POST setAckPreference

Sets the acknowledge notification preference to true or false. If it is set to true, then every acknowledge message of the delivered messages are sent to the webhook address if a webhook address is available. Otherwise, no acknowledgement is sent to the webhook.

  • Body :
{
    "preference": true / false
}

** Successful Response: returns the current product information.

{
    "pid": "...",
    "webhook": "...",
    "ack_delivery": 0 / 1, 
    "phone_limit": ...
}

Processes That Inform Webhook

Incoming Messages

Every single incoming message is delivered into the webhook address if there is one available.

Successful Return Format :

{ 
    "productId": "...",
    "phoneId": ...,
    "message": { 
        "type": "text" / "image" / ... , 
        (message specific parameters)
    },
    "user": { 
        "id": "...",
        "name": "...",
        "phone": "...",
        "image": "..." 
    },
    "conversation": "...",
    "receiver": "...",
    "timestamp": ...,
    "type": "message",
    "reply":"..." 
}
PARAMETES USAGE
user specific information about the user, who sent the message to us
conversation chat id
receiver receiver's phone number, in that case our phone number
timestamp the timestamp of the incoming message (last '000' are excluded)

Acknowledge Information of the Sent Messages

If the acknowledge notifications are enabled, then for evety acknowledgement, a notification is sent to the webhook address. Acknowledge messages are checked in every 2 seconds and every single acknowledgement after the previous delivery are placed to an array and this array is returned to the user.

Successful Return Format :

[ 
    { 
        "ackType": "delivered" / "reached" / "seen",       
        "chatId": "...",
        "msgId": "..." 
    },
    { 
        "ackType": "delivered" / "reached" / "seen",       
        "chatId": "...",
        "msgId": "..." 
    },
    ... 
]
PARAMETES USAGE
ackType delivered: for 1 tick, reached: for 2 ticks, seen: for blue ticks
chatId the id of the specific chat where the acknowledged message is placed
msgId the id of the specific message acknowledged
Have a question about this API?Ask the API Provider.
Developers who viewed Maytapi WhatsApp also viewed

Install SDK for (Node.js)Unirest

OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication