WhatsApp API

Instant WhatsApp API for PHP with SentWA API Gateway

Send messages automatically with WhatsApp Official API with PHP code can be a little tricky and complicated if you don't know about setting up the server, creating a message template, and many things that are required to run WhatsApp Official API. But you will not find those difficulties on SentWA.

Send WhatsApp messages with PHP is so easy with our HTTP APIs feature. We also provide a sample code for you to get started within minutes on SentWA. Below is a sample code to send a message with PHP on SentWA.

				
					<?php
$curl = curl_init();

$access_token = '{YOUR_ACCESS_TOKEN}';
$instance_id = '{INSTANCE_ID}';
$type = 'text';
$message = '{MESSAGE}';
$number = '{PHONE_NUMBER}';

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://dash.sentwa.com/api/send.php?access_token=' . $access_token . '&instance_id=' . $instance_id . '&message=' . $message . '&number=' . $number . '&type=' . $type,
  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',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

// Response:
// {"status":"success","message":"Success","data":{"key":{"remoteJid":"...","fromMe":true,"id":"..."},"message":{"extendedTextMessage":{"text":"..."}},"messageTimestamp":"...","status":"PENDING"}}


				
			

Send WhatsApp message API free any time automatically with SentWA WhatsApp API Gateway now. Get your free trial by clicking register and access full-featured API from SentWA dashboard.

Leave a Reply

Your email address will not be published.