Skip to content

Mobizon é um poderoso gateway de SMS e ferramentas de marketing online.

License

Notifications You must be signed in to change notification settings

githubfollow/mobizon-br

 
 

Repository files navigation

Mobizon

Biblioteca para comunicação API HTTP Mobizon SMS

GitHub language count GitHub top language GitHub repo size NPM downloads GitHub license

Instalação

Baixe o node em nodejs.org e instale-o, caso ainda não tenha,

Pacote: npm i mobizon-node ou yarn add mobizon-node

Configuração:

const { mobizon } = require('mobizon-node');

mobizon.setConfig({
  apiServer: 'https://api.mobizon.com.br',
  apiKey: 'br01xxxxxx',
  format: 'json',
});

Exemplos de uso

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.

Testes

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.

Licença

Copyright © 2021 caioagiani.
Este projeto é licenciado MIT.

About

Mobizon é um poderoso gateway de SMS e ferramentas de marketing online.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 100.0%