1.1.0 • Published 6 years ago
twizo v1.1.0
Twizo Node.js API
Connect to the Twizo API using the Node.js library. This API includes functions to send verifications (2FA), SMS and Number Lookup.
Requirements
Get application secret and api host
To use the Twizo API client, the following things are required:
- Create a Twizo account
- Login on the Twizo portal
- Find your application secret
- Find your nearest api node
Installation
$ npm install --save twizo
$ npm install twizo
$ yarn add twizo
Getting started
Initialize the Twizo API with your api host and api secret
const twizo = require("twizo");
twizo.config(<yourTwizoHost>, <YourApiKey>);
Or you could set TWIZO_HOST
and TWIZO_API_KEY
in your environmental variables (through dotenv
or on your server).
Create a new verification
let verification;
twizo.verification.submit({
recipient: "60123456789"
})
.then(response => verification = response);
Verify token
twizo.verification.verify(response.messageId, "012345");
Send sms
twizo.sms.submit({
recipients: ["60123456789"],
sender: "Bob",
body: "Hey Alice, how are you doing?"
});
Examples
In the examples directory you can find some examples of how to use the api.
License
The MIT License. Copyright (c) 2016-2017 Twizo
Support
Contact: www.twizo.com — support@twizo.com