Baixe o node em nodejs.org e instale-o, caso ainda não tenha,
Pacote: npm i mobizon-node
ou yarn add mobizon-node
const { mobizon } = require('mobizon-node');
mobizon.setConfig({
apiServer: 'https://api.mobizon.com.br',
apiKey: 'br01xxxxxx',
format: 'json',
});
Confira em docs todos os response status code.
(async () => {
/** Saldo */
const getBalance = await mobizon.getBalance();
console.log(getBalance);
/** Encurtar URL */
const createShort = await mobizon.createShort({
data: {
fullLink: 'https://mobizon.com.br',
status: 1,
expirationDate: '',
comment: 'Shortened link.',
},
});
console.log(createShort);
/** Enviar SMS */
const sendSms = await mobizon.sendSms({
recipient: '5511900000000',
from: '',
text: 'SMS sent by Mobizon.',
});
console.log(sendSms);
})();
Dê uma olhada em example.js para mais casos de uso.
yarn lint && jest --setupFiles dotenv/config --detectOpenHandles --forceExit
$ eslint . --ext .js
PASS __tests__/shortlink.test.js
PASS __tests__/sms.test.js
PASS __tests__/balance.test.js
Test Suites: 3 passed, 3 total
Tests: 14 passed, 14 total
Snapshots: 0 total
Time: 7.013 s
Ran all test suites.
Done in 8.41s.
Copyright © 2021 caioagiani.
Este projeto é licenciado MIT.