Live API
WhatsApp Cloud API
Official Meta Partner | 99.9% Uptime | Enterprise-grade security
https://greenping.in/api/{vendorUid}/
Authentication
Token is passed as a query parameter in the URL.
URL Format:
https://greenping.in/api/{vendorUid}/endpoint?token={your_token}
Important:
• Token is required for all API calls
• Token must be passed as a query parameter: ?token=YOUR_API_TOKEN
• Keep your token secure and never expose it in client-side code
Before You Start
✓ Complete WhatsApp Cloud API Setup in your dashboard
✓ Ensure your WhatsApp Business Account is active and verified
✓ Phone numbers must be registered with WhatsApp Business API
✓ Template messages require Meta-approved templates
✓ Use from_phone_number_id (optional) - if not provided, default phone number will be used
Code Examples
Send Template Message - Multi-language examples
PHP (Laravel HTTP Client):
try {
$response = Http::post(
'https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb',
[
"from_phone_number_id" => "1066950406512655",
"phone_number" => $mobile,
"template_name" => "new_enquriy",
"template_language" => "en_US",
"field_1" => $name,
"field_2" => $service,
]
);
if ($response->successful()) {
$data = $response->json();
}
} catch (\Exception $e) {
\Log::error("WHATSAPP ERROR: " . $e->getMessage());
}
Node.js (Axios):
const axios = require('axios');
try {
const response = await axios.post(
'https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb',
{
"from_phone_number_id": "1066950406512655",
"phone_number": mobile,
"template_name": "new_enquriy",
"template_language": "en_US",
"field_1": name,
"field_2": service
}
);
console.log(response.data);
} catch (error) {
console.error('WHATSAPP ERROR:', error.message);
}
Python (Requests):
import requests
import json
try:
url = "https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb"
payload = {
"from_phone_number_id": "1066950406512655",
"phone_number": mobile,
"template_name": "new_enquriy",
"template_language": "en_US",
"field_1": name,
"field_2": service
}
response = requests.post(url, json=payload)
response.raise_for_status()
data = response.json()
print(data)
except Exception as e:
print(f"WHATSAPP ERROR: {e}")
JavaScript (Fetch API):
async function sendTemplateMessage() {
try {
const response = await fetch(
'https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb',
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"from_phone_number_id": "1066950406512655",
"phone_number": mobile,
"template_name": "new_enquriy",
"template_language": "en_US",
"field_1": name,
"field_2": service
})
}
);
const data = await response.json();
console.log(data);
} catch (error) {
console.error('WHATSAPP ERROR:', error);
}
}
Java (OkHttp):
import okhttp3.*;
public class WhatsAppAPI {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
String json = "{\"from_phone_number_id\":\"1066950406512655\",\"phone_number\":\"918856066529\",\"template_name\":\"new_enquriy\",\"template_language\":\"en_US\",\"field_1\":\"John Doe\",\"field_2\":\"Web Development\"}";
Request request = new Request.Builder()
.url("https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb")
.post(RequestBody.create(mediaType, json))
.build();
try {
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
} catch (Exception e) {
System.err.println("WHATSAPP ERROR: " + e.getMessage());
}
}
}
Go:
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func sendTemplateMessage() {
url := "https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb"
payload := map[string]interface{}{
"from_phone_number_id": "1066950406512655",
"phone_number": "918856066529",
"template_name": "new_enquriy",
"template_language": "en_US",
"field_1": "John Doe",
"field_2": "Web Development",
}
jsonData, _ := json.Marshal(payload)
resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("WHATSAPP ERROR:", err)
return
}
defer resp.Body.Close()
}
Ruby:
require 'net/http'
require 'json'
begin
uri = URI("https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb")
payload = {
"from_phone_number_id" => "1066950406512655",
"phone_number" => "918856066529",
"template_name" => "new_enquriy",
"template_language" => "en_US",
"field_1" => "John Doe",
"field_2" => "Web Development"
}
response = Net::HTTP.post(uri, payload.to_json, "Content-Type" => "application/json")
puts response.body
rescue => e
puts "WHATSAPP ERROR: #{e.message}"
end
C# (HttpClient):
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
public class WhatsAppAPI
{
public static async Task SendTemplateMessage()
{
using var client = new HttpClient();
var payload = new {
from_phone_number_id = "1066950506512655",
phone_number = "918856066529",
template_name = "new_enquriy",
template_language = "en_US",
field_1 = "John Doe",
field_2 = "Web Development"
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
try
{
var response = await client.PostAsync(
"https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb",
content
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
catch (Exception e)
{
Console.WriteLine($"WHATSAPP ERROR: {e.Message}");
}
}
}
Rust (Reqwest):
use reqwest;
use serde_json::json;
async fn send_template_message() -> Result<(), Box> {
let url = "https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb";
let payload = json!({
"from_phone_number_id": "1066950406512655",
"phone_number": "918856066529",
"template_name": "new_enquriy",
"template_language": "en_US",
"field_1": "John Doe",
"field_2": "Web Development"
});
let client = reqwest::Client::new();
let response = client
.post(url)
.json(&payload)
.send()
.await?;
println("{:?}", response.text().await?);
Ok(())
}
Swift (URLSession):
import Foundation
func sendTemplateMessage() {
let url = URL(string: "https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb")!
let payload: [String: Any] = [
"from_phone_number_id": "1066950406512655",
"phone_number": "918856066529",
"template_name": "new_enquriy",
"template_language": "en_US",
"field_1": "John Doe",
"field_2": "Web Development"
]
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("WHATSAPP ERROR: \(error)")
return
}
if let data = data {
let responseString = String(data: data, encoding: .utf8)
print(responseString ?? "No response")
}
}
task.resume()
}
Kotlin (OkHttp):
import okhttp3.*
fun sendTemplateMessage() {
val client = OkHttpClient()
val json = """{"from_phone_number_id":"1066950406512655","phone_number":"918856066529","template_name":"new_enquriy","template_language":"en_US","field_1":"John Doe","field_2":"Web Development"}"""
val request = Request.Builder()
.url("https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb")
.post(RequestBody.create(MediaType.parse("application/json"), json))
.build()
try {
val response = client.newCall(request).execute()
println(response.body()?.string())
} catch (e: Exception) {
println("WHATSAPP ERROR: ${e.message}")
}
}
HTTP Request (cURL):
curl -X POST "https://greenping.in/api/e367815c-67a6-457c-8a55-9ae763ba1316/contact/send-template-message?token=5n0onmquSRoeqRAvT33MbOKcyAirvQGJzjc5k3xoxfmKJjarfj3w5RQpwe15UPLb" \
-H "Content-Type: application/json" \
-d '{
"from_phone_number_id": "1066950406512655",
"phone_number": "918856066529",
"template_name": "new_enquriy",
"template_language": "en_US",
"field_1": "John Doe",
"field_2": "Web Development"
}'
| Parameter | Type | Required | Description |
|---|---|---|---|
| URL Token | query param | * | API token passed as ?token=... |
| from_phone_number_id | string | Optional | Your WhatsApp Business phone number ID |
| phone_number | string | * | Recipient's WhatsApp number |
| template_name | string | * | Name of the approved template |
| template_language | string | * | Language code (en, hi, etc.) |
| field_1 to field_4 | string | Optional | Template body variables |
Send Template Message
POST
https://greenping.in/api/{vendorUid}/contact/send-template-message?token={token}
Template
URL Format: https://greenping.in/api/{vendorUid}/contact/send-template-message?token={your_api_token}
Request Example:
{
"from_phone_number_id": "1066950406512655",
"phone_number": "918856066529",
"template_name": "new_enquriy",
"template_language": "en_US",
"field_1": "John Doe",
"field_2": "Web Development"
}
{
"from_phone_number_id": "1066950406512655",
"phone_number": "918856066529",
"template_name": "new_enquriy",
"template_language": "en_US",
"field_1": "John Doe",
"field_2": "Web Development"
}
Success Response:
{
"status": "success",
"message_id": "wamid.1234567890",
"sent_to": "918856066529"
}
{
"status": "success",
"message_id": "wamid.1234567890",
"sent_to": "918856066529"
}
Send Text Message
POST
https://greenping.in/api/{vendorUid}/contact/send-message?token={token}
Text
URL Format: https://greenping.in/api/{vendorUid}/contact/send-message?token={your_api_token}
| Parameter | Type | Required | Description |
|---|---|---|---|
| URL Token | query param | * | API token passed as ?token=... |
| from_phone_number_id | string | Optional | Your WhatsApp Business phone number ID |
| phone_number | string | * | Recipient's WhatsApp number |
| message_body | string | * | Text content of the message |
Request Example:
{
"from_phone_number_id": "",
"phone_number": "918856066529",
"message_body": "your message body",
"contact": {
"first_name": "Johan",
"last_name": "Doe",
"email": "johndoe@domain.com",
"country": "india",
"language_code": "en",
"groups": "examplegroup1,examplegroup2",
"custom_fields": {"BDay": "2025-09-04"}
}
}
{
"from_phone_number_id": "",
"phone_number": "918856066529",
"message_body": "your message body",
"contact": {
"first_name": "Johan",
"last_name": "Doe",
"email": "johndoe@domain.com",
"country": "india",
"language_code": "en",
"groups": "examplegroup1,examplegroup2",
"custom_fields": {"BDay": "2025-09-04"}
}
}
Send Media Message
POST
https://greenping.in/api/{vendorUid}/contact/send-media-message?token={token}
Media
URL Format: https://greenping.in/api/{vendorUid}/contact/send-media-message?token={your_api_token}
| Parameter | Type | Required | Description |
|---|---|---|---|
| URL Token | query param | * | API token passed as ?token=... |
| from_phone_number_id | string | Optional | Your WhatsApp Business phone number ID |
| phone_number | string | * | Recipient's WhatsApp number |
| media_type | string | * | image, video, document, or audio |
| media_url | URL | * | Public URL of the media file |
Request Example:
{
"from_phone_number_id": "",
"phone_number": "918856066529",
"media_type": "document",
"media_url": "https://images.pexels.com/photos/276267/pexels-photo-276267.jpeg",
"caption": "your caption for image or video",
"file_name": "your file name for document",
"contact": {
"first_name": "Johan",
"last_name": "Doe"
}
}
{
"from_phone_number_id": "",
"phone_number": "918856066529",
"media_type": "document",
"media_url": "https://images.pexels.com/photos/276267/pexels-photo-276267.jpeg",
"caption": "your caption for image or video",
"file_name": "your file name for document",
"contact": {
"first_name": "Johan",
"last_name": "Doe"
}
}
Send Interactive Message
POST
https://greenping.in/api/{vendorUid}/contact/send-interactive-message?token={token}
Interactive
URL Format: https://greenping.in/api/{vendorUid}/contact/send-interactive-message?token={your_api_token}
| Parameter | Type | Required | Description |
|---|---|---|---|
| URL Token | query param | * | API token passed as ?token=... |
| interactive_type | string | * | button, cta_url, or list |
| body_text | string | * | Main message body |
Button Type Example:
{
"interactive_type": "button",
"header_type": "text",
"header_text": "Choose an option",
"body_text": "Please select:",
"buttons": {"1": "Yes", "2": "No", "3": "Maybe"}
}
{
"interactive_type": "button",
"header_type": "text",
"header_text": "Choose an option",
"body_text": "Please select:",
"buttons": {"1": "Yes", "2": "No", "3": "Maybe"}
}
Create Contact
POST
https://greenping.in/api/{vendorUid}/contact/create?token={token}
Create
URL Format: https://greenping.in/api/{vendorUid}/contact/create?token={your_api_token}
{
"phone_number": "4885057299",
"first_name": "John",
"last_name": "Doe",
"email": "john@domain.com",
"country": "india",
"language_code": "en",
"groups": "group1,group2",
"custom_fields": {"BDay": "2025-09-01"}
}
"phone_number": "4885057299",
"first_name": "John",
"last_name": "Doe",
"email": "john@domain.com",
"country": "india",
"language_code": "en",
"groups": "group1,group2",
"custom_fields": {"BDay": "2025-09-01"}
}
Update Contact
POST
https://greenping.in/api/{vendorUid}/contact/update/{phoneNumber}?token={token}
Update
URL Format: https://greenping.in/api/{vendorUid}/contact/update/{phoneNumber}?token={your_api_token}
{
"first_name": "Johan",
"last_name": "Doe",
"email": "updated@domain.com",
"whatsapp_opt_out": false,
"enable_ai_bot": true,
"groups": "examplegroup1,examplegroup9",
"custom_fields": {"BDay": "2025-09-04"}
}
"first_name": "Johan",
"last_name": "Doe",
"email": "updated@domain.com",
"whatsapp_opt_out": false,
"enable_ai_bot": true,
"groups": "examplegroup1,examplegroup9",
"custom_fields": {"BDay": "2025-09-04"}
}
Assign Team Member
POST
https://greenping.in/api/{vendorUid}/contact/assign-team-member?token={token}
Assign
URL Format: https://greenping.in/api/{vendorUid}/contact/assign-team-member?token={your_api_token}
{
"username_or_email": "team123@test.com",
"phone_number": "918856066529",
"enable_ai_bot": 0,
"enable_reply_bot": 0
}
"username_or_email": "team123@test.com",
"phone_number": "918856066529",
"enable_ai_bot": 0,
"enable_reply_bot": 0
}
Rate Limits & Headers
| Rate Limit | 80 requests per second (standard plan) |
| Authentication | Token in URL as query parameter |
| Response Format | JSON only |
| Encoding | UTF-8 |
Error Codes
| Code | Meaning | Action Required |
|---|---|---|
| 401 | Invalid or missing token | Check token in URL parameter |
| 403 | Invalid vendor UID or authentication | Check your vendor UID and token |
| 404 | Endpoint not found | Verify the URL path |
| 422 | Validation error | Check request parameters |
Webhook URL
https://greenping.in/webhook/{vendorUid}
Webhook Response Example:
{
"contact": {
"status": "existing/updated/new",
"phone_number": "XXXXXXXXXX",
"uid": "XXXXXXXXXX",
"first_name": "XXXXXXXXXX"
},
"message": {
"whatsapp_message_id": "wamid.XXXXXXXXXX",
"is_new_message": true,
"media": {"type": "image", "link": "url"}
}
}
{
"contact": {
"status": "existing/updated/new",
"phone_number": "XXXXXXXXXX",
"uid": "XXXXXXXXXX",
"first_name": "XXXXXXXXXX"
},
"message": {
"whatsapp_message_id": "wamid.XXXXXXXXXX",
"is_new_message": true,
"media": {"type": "image", "link": "url"}
}
}