Facebookpixel Dev DOC WhatsApp - SMSMobileAPI

WhatsApp Documentation

This documentation is specific to sending and receiving WhatsApp messages.

Click here to learn more about all the features our WhatsApp integration offers.

At SMSmobileAPI, we strive to make our API as compatible as possible with any architecture or platform.
Whether you’re using REST, SOAP, cURL, or various programming languages like Python, JavaScript, PHP, and more, our API is designed to integrate seamlessly into your projects.

We also have ready-to-use plugins for e-commerce solutions and software. Click here to discover them.

API REST
cURL
JavaScript JavaScript
Python Python
Node.js Node.js
Ruby Ruby
WSDL
Send WhatsApp
Resend Message
Synchronization
Retrieve Messages
Authentication

Send WhatsApp API 

This API endpoint is used to send WhatsApp messages.

Endpoint:

GET POST https://api.smsmobileapi.com/sendsms
 

Parameters:

- apikey: Your unique API key.
- recipients: The recipient's phone number (The number must be available on WhatsApp). Enter the phone number starting with the country code (without ‘+’ and without ‘00’), followed directly by the rest of your number. Exemple 191728660
- message: The message to send (Multiple lines possible). 
- url_media: The direct URL of the media file you want to send via WhatsApp. Must start with https:// and point to a valid PDF, doc or image file. The file must be publicly accessible without authentication.
Supported : pdf, xml, doc, docx, odt, rtf, txt, tex, xls, xlsx, csv, ods, ppt, pptx, odp, zip, rar, 7z, tar, gz
jpg, jpeg, png
- waonly: must have the value yes -> Required to specify that only one WhatsApp message should be sent
- pdf_with_image- >If the value is "yes", then an image preview of the PDF will be displayed to accompany the message (only if it is a PDF).
- url_media_shorted- >If the value is "yes", In the case of a PDF with the condition [pdf_with_image=yes], the display of the download link for the PDF goes through a short URL

Example without media :

GET https://api.smsmobileapi.com/sendsms?apikey=YOUR_API_KEY&waonly=yes&recipients=191728660&message=Hello%20World

Example with media :

GET https://api.smsmobileapi.com/sendsms?apikey=YOUR_API_KEY&waonly=yes&recipients=191728660&message=Hello%20World&url_media=https://smsmobileapi.com/logo.png

Format Text in WhatsApp :

  • Italic: Use underscores → _text_
  • Bold: Use asterisks → *text*
  • Strikethrough: Use tildes → ~text~
  • Monospace: Use backticks → ```text```
For example : _Hello_ world, How *are* you ~today~ from ```SMSMobileAPI```

Resend an unsent WhatsApp messages

 This API endpoint is used to resend an unsent message (only if the message has an error status)

Endpoint:

GET   POST https://api.smsmobileapi.com/resendwa/

Parameter: 

- guid: (required) GUID of the message to be resent.

Example:

GET https://api.smsmobileapi.com/resendwa/?apikey=YOUR_API_KEY&guid=GUID_OF_THE_MESSAGE



Synchronization to retrieve message  

This API endpoint is used to send a request to synchronize and retrieve WhatsApp messages.
This step is mandatory and must be executed before calling the endpoint that retrieves the messages.

Warning: Synchronization is strictly required only for the message retrieval function. Do not start a synchronization to send a message.

Endpoint:

GET https://api.smsmobileapi.com/getwa/synchronisation/
 

Parameter:

- apikey (required): The API key you have or will receive.  

Example:

GET https://api.smsmobileapi.com/getwa/synchronisation/?apikey=YOUR_API_KEY

Reply :

{
"error": "0",
"messages": "synchronized",
"expire_at ": "2025-03-11 12:27:00",
"expire_at_unix": "1741692420",
}

Retrieve WhatsApp Message 

This API endpoint is used to retrieve WhatsApp messages received.

Endpoint:

GET https://api.smsmobileapi.com/getwa
 

Parameter:

- apikey (required): The API key you have or will receive.  
- before (optional): Pass the timestamp as a parameter and display the records below this timestamp.
- date (optional): (yyyy-mm-dd) get all records based on the date.
- message_type (optional):
  • Leave empty to see all (text and audi messages)
  • use 'text' to see only text messages
  • use 'audio' to see only audio messages converted to text


Example:

GET https://api.smsmobileapi.com/getwa/?apikey=YOUR_API_KEY

Reply :

{
"date": "2025-03-11",
"hour": "12:27:00",
"timestamp": "1741692420",
"number": "19176728660",
"contact": "Smsmobileapi",
"message": "Can you tell me when I will receive my order?",
"guid": "652fcfc0-12a8-46f5-b5ba-9391135b8b4c",
"more": {
"auto_reply": "1",
"transfert_to_email": "1",
"chatgpt_reply": "1"
},
"chatgpt": {
"prompt_tokens": "900",
"completion_tokens": "10",
"total_tokens": "910",
"total_tokens_cost": "0.182"
"response": "Your order #576 will be shipped tomorrow."
}
}

Authentication

 

The SMSMobile API supports two authentication methods: using a simple API Key or the OAuth2 protocol with a client ID and client secret.

1. API Key Authentication  

To send or retrieve WhatsApp messages via our API, authentication is required using an API key. This ensures secure and authorized access to the messaging service. Simply include your API key in the request to authenticate and start sending messages seamlessly.

2. OAuth2 Authentication

OAuth2 provides a more secure and scalable authentication method.
You will need to use a client ID and client secret to obtain an access token, which should then be included in your API requests using the Authorization header.

The client_id and client_secret are available in your dashboard.

Obtaining an Access Token

To get an access token, send a POST request to the token endpoint with your client ID and client secret.

curl -X POST https://api.smsmobileapi.com/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=1ab0ex4b4c1ef2c800690d" \
-d "client_secret=3ed108a93d0414074b94364290b6a7348475e93a0567005"

Using the Access Token:

Once you have the access token, include it in the Authorization header of your API requests:

curl -X POST https://api.smsmobileapi.com/sendsms?waonly=yes \
-H "Authorization: Bearer abc123xyz456" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "recipients=+1234567890" \
-d "message=Hello"

Which Method Should You Use?

- Use API Key Authentication for quick and straightforward integrations.

- Use OAuth2 Authentication for enhanced security and scalability in your integrations.


It is also possible to send a WhatsApp message and an SMS simultaneously.

If you have any questions, suggestions, or need assistance, our team is here to help.
Feel free to reach out to us at api@smsmobileapi.com

Connect My Mobile