Sinch Verification node module
Node module to make Sinch number verification requests from within Node or Web applications (using Browserify).
Installing
Install is straight forward using npm;
npm install sinch-verification --save
Note: Module is compatible with browserify
Include module in your project
var sinchVerification = require('sinch-verification')({
key: 'YOUR APPLICATION_KEY',
secret: 'YOUR_APPLICATION_SECRET'
});
To create a new verification session, simply call the createVerification()
method as in this example:
var sinchSms = require('sinch-sms')({
key: 'YOUR_APPLICATION_KEY',
secret: 'YOUR_APPLICATION_SECRET'
});
var verification = sinchVerification.createVerification(number);
verification.initialize().then(function(result) {
verification.verify(code).then(function(result) {
console.log('Success', result);
}).fail(function(error) {
console.log('Failure', error);
});
}).fail(function(error) {
console.log('Failure initializing', error);
})
Where variables number
and code
contain phone number to verify and the code that was sent by SMS.
For a more complete sample, please see the provided samples.
Feedback
Questions and/or feedback on this module can be sent by contacting dev@sinch.com.
License
The MIT License (MIT)
Copyright (c) 2015 Sinch AB
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.