WhatsApp OTP API
Examples:
Curl
curl -X POST https://api.verifyway.com/api/v1/ \
-H 'Authorization: Bearer API_KEY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"recipient":"31612345678",
"type":"otp",
"code":"123456"
}'
Languages: (Default English)
Changing template language supported, please contact us to enable other language.
PHP Example using Curl:
<?php $api_url = 'https://api.verifyway.com/api/v1/'; $api_key = 'API_KEY'; // Replace with your actual API key $data = array( 'recipient' => '31612345678', 'type' => 'otp', 'code' => '123456' ); $headers = array( 'Authorization: Bearer ' . $api_key, 'Content-Type: application/json', 'Accept: application/json' ); $ch = curl_init($api_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); if ($response === false) { echo 'cURL Error: ' . curl_error($ch); } else { echo 'Response: ' . $response; } curl_close($ch); ?>
PHP Example using Guzzle:
<?php require 'vendor/autoload.php'; // Make sure to include the Guzzle library use GuzzleHttp\Client; $api_url = 'https://api.verifyway.com/api/v1/'; $api_key = 'API_KEY'; // Replace with your actual API key $data = array( 'recipient' => '31612345678', 'type' => 'otp', 'code' => '123456' ); $headers = array( 'Authorization' => 'Bearer ' . $api_key, 'Content-Type' => 'application/json', 'Accept' => 'application/json' ); $client = new Client(); $response = $client->post($api_url, [ 'headers' => $headers, 'json' => $data ]); $body = $response->getBody(); echo $body; ?>
Responses:
Success
{
"status": "success",
"message_id": "RANDOM_ID",
"recipient": "+31612345678",
"code": "123456"
}
Failure
{ "error": "detail of the error" }