Verigator API
REST API to send one-time passwords worldwide instantly with SMS, WhatsApp, and Viber.
Overview
A dedicated service for delivering One-Time Passwords (OTPs) with the highest quality worldwide.
- No time-consuming registration processes
- SMS, Viber, and WhatsApp
- Improved performance by up to 30%
Looking to send marketing or transactional SMS messages? Use our Omnichannel API instead.
1. Enable Verigator
Verigator is currently in early access and we have to manually enable it before you can start using it.
2. Install a suitable library
The fastest way to get started with the API is to use our official libraries.
Select your preferred programming language and follow the instructions.- Python
- Node
- PHP
- Java
- Ruby
- .NET
With PIP
To install the API client library, simply execute:
pip install messente-api
Or with Setuptools
To install the API client library, simply execute:
python setup.py install --user
then import the package:
import messente_api
Install with composer
composer require messente/messente-api-php
Maven users
Allow fetching messente-api from jcenter by placing a settings.xml file to ~/.m2 maven folder containing the following:
<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<profiles>
<profile>
<id>bintray</id>
<repositories>
<repository>
<id>central</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>bintray</activeProfile>
</activeProfiles>
</settings>
To install the API client library to your local Maven repository, add the dependency to your project's POM:
<dependency>
<groupId>com.messente.api</groupId>
<artifactId>messente-api</artifactId>
<version>4.2.0</version>
</dependency>
Now, you can install the library by running:
mvn clean install
Gradle users
Add jcenter repository to your project's build file:
repositories { jcenter() }
Also add the dependency to your project's build file:
dependencies { implementation 'com.messente.api:messente-api' }
Others
Firstly, generate the JAR by executing:
mvn package -Dmaven.javadoc.skip=true
Then manually install the following JARs:
- target/messente-api-$VERSION_NUMBER.jar
- target/messente-api-$VERSION_NUMBER-sources.jar
- target/lib/*.jar
3. Send the OTP like any other SMS
Message content must match exactly the format "XXXX is your verification code".
Once you send the message as SMS then it is automatically converted to multi-channel Verigator solution.
The order of the messages are determined by Messente.
"XXXX" can be any digit between 1-10 characters long- Python
- Node
- PHP
- Java
- Ruby
- .NET
- cURL
# pip install messente-api
from pprint import pprint
from messente_api import (
OmnimessageApi,
SMS,
Omnimessage,
Configuration,
ApiClient,
OmnimessageMessagesInner,
)
from messente_api.rest import ApiException
configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"
api_instance = OmnimessageApi(ApiClient(configuration))
sms = SMS(sender="<sender name (optional)>", text="1234 is your verification code")
sms_inner = OmnimessageMessagesInner(sms)
omnimessage = Omnimessage(messages=[sms_inner], to="<recipient_phone_number>")
try:
response = api_instance.send_omnimessage(omnimessage)
print(
"Successfully sent Omnimessage with id: %s that consists of the following messages:" % response.omnimessage_id
)
for message in response.messages:
pprint(message)
except ApiException as exception:
print("Exception when sending an omnimessage: %s\n" % exception)
// npm i messente_api
const MessenteApi = require("messente_api");
const defaultClient = MessenteApi.ApiClient.instance;
const basicAuth = defaultClient.authentications["basicAuth"];
basicAuth.username = "YOUR_MESSENTE_API_USERNAME";
basicAuth.password = "YOUR_MESSENTE_API_PASSWORD";
const api = new MessenteApi.OmnimessageApi();
const sms = MessenteApi.SMS.constructFromObject({
sender: "<sender name (optional)>",
text: "1234 is your verification code",
});
const omnimessage = MessenteApi.Omnimessage.constructFromObject({
messages: [sms],
to: "<recipient_phone_number>",
});
api.sendOmnimessage(omnimessage, (error, data) => {
if (error) {
console.error(error);
} else {
console.log("API called successfully. Returned data: ", data);
}
});
// composer require messente/messente-api-php
require_once __DIR__.'/vendor/autoload.php';
use Messente\Api\Api\OmnimessageApi;
use Messente\Api\Model\Omnimessage;
use Messente\Api\Configuration;
use Messente\Api\Model\SMS;
$config = Configuration::getDefaultConfiguration()
->setUsername('YOUR_MESSENTE_API_USERNAME')
->setPassword('YOUR_MESSENTE_API_PASSWORD');
$apiInstance = new OmnimessageApi(
new GuzzleHttp\Client(),
$config
);
$omnimessage = new Omnimessage([
'to' => '<recipient_phone_number>',
]);
$sms = new SMS(
[
'text' => '1234 is your verification code',
'sender' => '<sender name (optional)>',
]
);
$omnimessage->setMessages([$sms]);
try {
$result = $apiInstance->sendOmnimessage($omnimessage);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling sendOmnimessage: ', $e->getMessage(), PHP_EOL;
}
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.*;
import com.messente.auth.HttpBasicAuth;
import java.util.List;
// repositories { mavenCentral() }
// dependencies { implementation 'com.messente.api:messente-api' }
public class Main {
public static void main(String[] args) {
ApiClient apiClient = new ApiClient();
OmnimessageApi apiInstance = new OmnimessageApi(apiClient);
HttpBasicAuth basicAuth = (HttpBasicAuth) apiClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR_MESSENTE_API_USERNAME");
basicAuth.setPassword("YOUR_MESSENTE_API_PASSWORD");
SMS sms = new SMS();
sms.text("1234 is your verification code");
sms.sender("<sender name(optional)>");
OmnimessageMessagesInner smsOmnimessageInner = new OmnimessageMessagesInner(sms);
smsOmnimessageInner.setActualInstance(sms);
Omnimessage omnimessage = new Omnimessage();
omnimessage.setMessages(List.of(smsOmnimessageInner));
omnimessage.setTo("<recipient_phone_number>");
try {
OmniMessageCreateSuccessResponse result = apiInstance.sendOmnimessage(omnimessage);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling sendOmnimessage");
System.err.println(e.getResponseBody());
}
}
}
# gem install messente_api
require 'messente_api'
MessenteApi.configure do |config|
config.username = 'YOUR_MESSENTE_API_USERNAME'
config.password = 'YOUR_MESSENTE_API_PASSWORD'
end
api_instance = MessenteApi::OmnimessageApi.new
omnimessage = MessenteApi::Omnimessage.new
omnimessage.to = '<recipient_phone_number>'
omnimessage.messages = [
MessenteApi::SMS.new(
sender: '<sender name (optional)>',
text: '1234 is your verification code'
)
]
begin
result = api_instance.send_omnimessage(omnimessage)
puts result
rescue MessenteApi::ApiError => e
puts "Exception when calling send_omnimessage: #{e}"
puts e.response_body
end
// PM > Install-Package com.Messente.Api
using System;
using System.Diagnostics;
using System.Collections.Generic;
using com.Messente.Api.Api;
using com.Messente.Api.Client;
using com.Messente.Api.Model;
namespace Example
{
public class SendOmniMessageExample
{
public static void Main()
{
Configuration conf = new Configuration
{
Username = "YOUR_MESSENTE_API_USERNAME",
Password = "YOUR_MESSENTE_API_PASSWORD"
};
var apiInstance = new OmnimessageApi(conf);
var sms = new SMS(sender: "<sender name (optional)>", text: "1234 is your verification code!");
OmnimessageMessagesInner smsOmnimessageInner = new OmnimessageMessagesInner(sms)
{
ActualInstance = sms
};
var omnimessage = new Omnimessage(
to: "<recipient_phone_number>",
messages: new List { smsOmnimessageInner }
);
try
{
var result = apiInstance.SendOmnimessage(omnimessage);
Console.WriteLine(result.ToJson());
}
catch (Exception e)
{
Console.WriteLine("Exception when calling SendOmnimessage: " + e.Message);
}
}
}
}
curl -X POST \
'https://api.messente.com/v1/omnimessage' \
-u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD \
-H 'Content-Type: application/json' \
-d '{
"to": <recipient_phone_number>,
"messages": [
{
"channel": "sms",
"sender": <sender name (optional)>,
"text": "1234 is your verification code"
}
]
}'
4. Track the message delivery status
Use the IDs in the API response to track message delivery statuses.
Messente tracks your sent message and reports status updates back to you.
To be able to view the status, you must add a callback URL to the message. Messente will use this URL to make HTTP POST requests, if there is a status update.
Learn more about the delivery status{
"messages": [
{
"channel": "viber",
"message_id": "2311234-7c23-4f7e-1234-02761e55ffdd",
"sender": "Verigator"
},
{
"channel": "whatsapp",
"message_id": "53eb1234-695f-1234-9ab0-86425e78ede0",
"sender": "Verigator"
},
{
"channel": "sms",
"message_id": "6e821234-edf2-4fe5-1234-b62062037c56",
"sender": "Verigator"
}
],
"omnimessage_id": "2f151234-e772-48fb-a66a-1234fb3f203e",
"to": "+372555666777"
}
Congratulations!
You're now ready to start sending OTPs everywhere.
Learn more about delivery reports and error codes.