API Documentation

Abstract image representing API connections and code
REST API: Send WhatsApp Messages From Any Application

Integrate WhatsApp messaging directly into your own applications, software, or backend scripts with our simple and powerful REST API. Send text, media, and template messages programmatically from any language. Get your API keys from your WA-MExpress dashboard and start building today.

🚀 Simple & Powerful

A single, straightforward endpoint for all your messaging needs. Our API is designed for developer productivity, with clear parameters and predictable responses.

🌐 Multi-Language Support

With ready-to-use code examples in cURL, PHP, Node.js, and Python, you can integrate in minutes, regardless of your technology stack.

💬 Flexible Messaging

Send plain text, rich media files (PDF, images, documents), or powerful, pre-approved message templates with dynamic variables for personalization.

Authentication & Endpoint

All API requests are authenticated using your unique appkey and authkey, which can be found in your WA-MExpress client dashboard. All requests should be sent as a POST request to the following endpoint:

https://wa.mexpress.pk/api/create-message
Request Parameters
Parameter Type Required Description
appkey String Yes Your application key, found in the dashboard.
authkey String Yes Your authorization key for the user, found in the dashboard.
to Number Yes The recipient's full WhatsApp number including country code.
message String No The text message content (max 1000 characters). Required if template_id is not used.
template_id String No The ID of the pre-approved template you wish to send.
file String No A publicly accessible URL to a media file. Supported types: jpg, jpeg, png, webp, pdf, docx, xlsx, csv, txt.
variables Array No An associative array to replace dynamic variables in your template message. E.g., variables[{variableKey1}]="value".
Code Examples (cURL)

Use these examples to quickly test the API from your command line.

Text Message Only
curl --location --request POST 'https://wa.mexpress.pk/api/create-message' \ --form 'appkey="YOUR_APP_KEY"' \ --form 'authkey="YOUR_AUTH_KEY"' \ --form 'to="15550123456"' \ --form 'message="Example text message from the API."'
Text Message with File
curl --location --request POST 'https://wa.mexpress.pk/api/create-message' \ --form 'appkey="YOUR_APP_KEY"' \ --form 'authkey="YOUR_AUTH_KEY"' \ --form 'to="15550123456"' \ --form 'message="Here is the document you requested."' \ --form 'file="https://www.africau.edu/images/default/sample.pdf"'
Template Message Only
curl --location --request POST 'https://wa.mexpress.pk/api/create-message' \ --form 'appkey="YOUR_APP_KEY"' \ --form 'authkey="YOUR_AUTH_KEY"' \ --form 'to="15550123456"' \ --form 'template_id="order_confirmation_template"' \ --form 'variables[{customer_name}]="John Doe"' \ --form 'variables[{order_id}]="ORD-98765"'
Code Examples (PHP)

Integrate directly into your PHP applications.

Text Message Only
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://wa.mexpress.pk/api/create-message', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array( 'appkey' => 'YOUR_APP_KEY', 'authkey' => 'YOUR_AUTH_KEY', 'to' => '15550123456', 'message' => 'Example message from PHP' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
Code Examples (Node.js)

Examples for your JavaScript and Node.js projects.

Text Message Only
var request = require('request'); var options = { 'method': 'POST', 'url': 'https://wa.mexpress.pk/api/create-message', 'headers': {}, formData: { 'appkey': 'YOUR_APP_KEY', 'authkey': 'YOUR_AUTH_KEY', 'to': '15550123456', 'message': 'Example message from Node.js' } }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
Code Examples (Python)

Quickly send messages from your Python scripts.

Text Message Only
import requests url = "https://wa.mexpress.pk/api/create-message" payload = { 'appkey': 'YOUR_APP_KEY', 'authkey': 'YOUR_AUTH_KEY', 'to': '15550123456', 'message': 'Example message from Python' } files = [] headers = {} response = requests.request("POST", url, headers=headers, data=payload, files=files) print(response.text)
Successful Response

A successful API call will return the following JSON response.

{ "message_status": "Success", "data": { "from": "155501987654", "to": "15550123456", "status_code": 200 } }

Ready to Start Building?

Generate your API keys from your dashboard and start sending messages in minutes.

Get Your API Keys

The WA-MExpress REST API is a powerful tool for developers. Always keep your API keys secure and never expose them in client-side code. Ensure you have the proper consent from users before sending them messages.