Socket
Socket
Sign inDemoInstall

mitto-rest-client

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mitto-rest-client

The official nodejs wrapper for Mitto (https://www.mitto.ch/) REST API


Version published
Weekly downloads
4
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Mitto REST API Node.js client

This is the official Node.js client for the Mitto REST API (https://www.mitto.ch).

NPM-Package: https://www.npmjs.com/package/mitto-rest-client

Install

npm install mitto-rest-client

Usage

Simple SMS sending

var apiKey = "YOUR-API-KEY";
var testMode = false; // optional; set to true if you want to send a test messages (no delivery, no cost, but visible in your portal)

require("mitto-rest-client")
    .create(apiKey, testMode)
    .sendTextMessage("YourSender", "491771234567", "Hello World!");

Send flash SMS

var apiKey = "YOUR-API-KEY";

require("mitto-rest-client")
    .create(apiKey)
    .sendTextMessage("YourSender", "491771234567", "Hello World!", {flash: true});

Set a client reference

var apiKey = "YOUR-API-KEY";

require("mitto-rest-client")
    .create(apiKey)
    .sendTextMessage("YourSender", "491771234567", "Hello World!", {reference: "My internal reference number #1"});

// in the Mitto customer portal you can configure a DeliveryReport Callback URL; this will receive the "reference" parameter from above...
// alternatively you can support your Account Manager to set the URL for you.

Unicode SMS sending

var apiKey = "YOUR-API-KEY";

require("mitto-rest-client")
    .create(apiKey)
    .sendUnicodeTextMessage("YourSender", "491771234567", "привет");

Inspect response

var apiKey = "YOUR-API-KEY";

require("mitto-rest-client")
    .create(apiKey)
    .sendTextMessage(
        "YourSender",
        "491771234567",
        "Hello World!",
        null,
        function(error, apiResponse) {
            if(error) {
                console.error(error);
            }
            if(apiResponse) {
                console.log(
                    "ResponseCode: " + apiResponse.responseCode + "\n" +
                    "ResponseText: " + apiResponse.responseText + "\n" +
                    "MessageId: " + apiResponse.id + "\n" +
                    "Timestamp: " + apiResponse.timestamp + "\n" +
                    "TextLength: " + apiResponse.textLength + "\n\n"
                );
            }
        }
    );

Keywords

FAQs

Last updated on 05 Jun 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc