Skip to content
Cédric Belin edited this page Aug 30, 2024 · 7 revisions

Send SMS messages to your Free Mobile device via any internet-connected device.

For example, you can configure a control panel or storage connected to your home network to send a notification to your mobile phone when an event occurs.

Quick start

Important

SMS notifications require an API key. If you are not already registered, sign up for a Free Mobile account.

Get an API key

You first need to enable the SMS notifications in your subscriber account. This will give you an identification key allowing access to the Free Mobile API.

Screenshot

Get the library

Install the latest version of Free Mobile for Haxe with lix package manager:

lix +lib free_mobile

For detailed instructions, see the installation guide.

Usage

This library provides the Client class, which allow to send SMS messages to your mobile phone by using the sendMessage() method:

import free_mobile.Client;
using tink.CoreApi;

function main() {
  final client = new Client("your account identifier", "your API key");
  // For example: new Client("12345678", "a9BkVohJun4MAf")

  client.sendMessage("Hello World from Haxe!").handle(outcome -> switch outcome {
    case Success(_): trace("The message was sent successfully.");
    case Failure(error): trace('An error occurred: ${error.message}');
  });
}

The Client.sendMessage() method returns a Promise that resolves when the message has been sent.

Warning

The text of the messages will be automatically truncated to 160 characters: you can't send multipart messages using this library.

Clone this wiki locally