messente_api
v2.2.0
Published
Send and receive SMS, Viber, Telegram and WhatsApp messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups.
Downloads
15,902
Readme
Messente API Library
- Messente API version: 2.0.0
- NPM package version: 2.2.0
Messente is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds tools to help organizations connect their services to people anywhere in the world.
Installation
Install Messente API library with npm install messente_api --save
.
Features
Messente API has the following features:
- Omnichannel (external docs),
- Phonebook (external docs).
Messente API Library provides the operations described below to access the features.
BlacklistApi
- Adds a phone number to the blacklist
addToBlacklist
- Deletes a phone number from the blacklist
deleteFromBlacklist
- Returns all blacklisted phone numbers
fetchBlacklist
- Checks if a phone number is blacklisted
isBlacklisted
BulkMessagingApi
- Sends a bulk Omnimessage
sendBulkOmnimessage
ContactsApi
- Adds a contact to a group
addContactToGroup
- Creates a new contact
createContact
- Deletes a contact
deleteContact
- Lists a contact
fetchContact
- Lists groups of a contact
fetchContactGroups
- Returns all contacts
fetchContacts
- Removes a contact from a group
removeContactFromGroup
- Updates a contact
updateContact
DeliveryReportApi
- Retrieves the delivery report for the Omnimessage
retrieveDeliveryReport
GroupsApi
- Creates a new group with the provided name
createGroup
- Deletes a group
deleteGroup
- Lists a group
fetchGroup
- Returns all groups
fetchGroups
- Updates a group with the provided name
updateGroup
NumberLookupApi
- Requests info about phone numbers
fetchInfo
OmnimessageApi
- Cancels a scheduled Omnimessage
cancelScheduledMessage
- Sends an Omnimessage
sendOmnimessage
StatisticsApi
- Requests statistics reports for each country
createStatisticsReport
Auth
Type: HTTP basic authentication
Read the external getting-started article which explains API keys and Sender ID logic.
Getting started: sending an omnimessage
const MessenteApi = require('messente_api');
const defaultClient = MessenteApi.ApiClient.instance;
// Configure HTTP basic authorization: basicAuth
const basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR_MESSENTE_API_USERNAME';
basicAuth.password = 'YOUR_MESSENTE_API_PASSWORD';
const api = new MessenteApi.OmnimessageApi();
const viber = MessenteApi.Viber.constructFromObject({
text: 'Hello Viber!',
sender: 'Messente',
});
const sms = MessenteApi.SMS.constructFromObject({
text: 'Hello SMS!',
});
const whatsAppParameters = [MessenteApi.WhatsAppParameter.constructFromObject({type: 'text', text: 'hello whatsapp'})];
const whatsAppComponent = MessenteApi.WhatsAppComponent.constructFromObject({type: 'body', parameters: whatsAppParameters});
const whatsAppTemplate = MessenteApi.WhatsAppTemplate.constructFromObject({
name: '<template_name>',
language: new MessenteApi.WhatsAppLanguage(code='<language_code>'),
components: [whatsAppComponent],
});
const whatsapp = MessenteApi.WhatsApp.constructFromObject({
sender: "<sender name (optional)>",
template: whatsAppTemplate,
});
const omnimessage = MessenteApi.Omnimessage.constructFromObject({
messages: [whatsapp, viber, sms],
to: '<recipient_phone_number>',
});
api.sendOmnimessage(omnimessage, (error, data) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ', data);
}
});