Our RESTful SMS message API can enable any application to send SMS messages to recipients.

Using an API client with the SMS message API

The simplest way for an application to use the SMS API, is for it to use one of the pre‑built API Clients. If there isn’t a suitable API client for the application then it can call the SMS API directly.

Integrating an API client

First make sure that the applications development environment is setup with a suitable package manager.

Once the environment is set up and ready, install the API client

In your terminal run

$ npm install node-magnetise --save

Once the API client has been installed the application can begin sending SMS messages through the SMS message API with code similar to the following

var magnetise = require('node-magnetise').Client( 'your-api-key' );

magnetise.send( "Console", "+445555889993", "SMS integration - done", "Testing, campaign 2" )
  .on( 'success', function( data ) {
    console.info( 'send:', data );
  })
  .on( 'error', function( err ) {
    console.error( 'error:', err );
  });

Find out more about using the API clients.

Calling the SMS message API direct

The SMS message API is built using REST conventions, so if needed, it can be called directly – simply make a HTTP POST request to https://magneti.se/api/messages using this command

$ curl -X POST https://magneti.se/api/messages \
  -d apikey="your-api-key" \
  -d from="Console" \
  -d to="+45555889993" \
  -d message="SMS integration - done" \
  -d tags="Testing, campaign 2"

The SMS message API will respond with the status code 202 to indicate that it received the request and is processing it. The SMS API will also return information about the message being sent.

Delivery notification callbacks

A callback can be setup to notify the application when an SMS message is delivered. Find out how to set up a delivery notification callback.

Link tracking

It is also possible to enable link tracking to track when recipients click on links within an SMS message. Find out how toset up link tracking.