MENA | SDKs - How to Get Started
Contact
Showing 12 of 471 Results

SDKs - How to Get Started

Introduction

We've created a set of client libraries for our REST API to enable simple and effective integration of our API into your code in minutes.

This page has been prepared to give developers a quick overview and demonstration on how you can send your very first SMS.

Features

  1. Fast deployment
  2. Documented with code samples, processes and all
  3. Easy to use and understood by developers
  4. Frequently updated with new and upcoming features that will be available over REST API
  5. Integrated library with other SMSGlobal REST API solutions including our OTP API

How to get started

Sign up for a free SMSGlobal account today and get your API Key from our advanced SMS platform, MXT. Plus, enjoy unlimited free developer sandbox testing to try out your API in full!

The following guide will demonstrate how you can use SMSGlobal’s SDK to send your first message:

Sending SMS

There are three required parameters when sending a message:

  1. origin: This parameter is the 'from' number or alphanumeric sender ID to use as the source. This is limited to 11 characters.
  2. destination: This parameter is the 'to' number, the destination phone number for your SMS message. Format this number with a + along with the country code following the E.164 format. Note if using destinations[] parameter to send to multiple destinations, it is recommended to keep the amount of destination numbers under 500.
  3. message: The contents of your SMS message. If the body of your message is more than 160 GSM-7 characters (or 70 UCS-2 characters), your message will be sent as a multi-part message.


 

Node.js
var payload = {
    origin: 'from number',
    destination: 'destination',
    message: 'This is a test message'
}
smsglobal.sms.send(payload, function (error, response) {
    console.log(response);
});
PHP
<?php
require_once __DIR__ . '/vendor/autoload.php';
// get your REST API keys from MXT https://mxt.smsglobal.com/integrations
\SMSGlobal\Credentials::set('YOUR_API_KEY', 'YOUR_SECRET_KEY');
$sms = new \SMSGlobal\Resource\Sms();
try {
    $response = $sms->sendToOne('DESTINATION_NUMBER', 'This is a test message.');
    print_r($response['messages']);
} catch (\Exception $e) {
    echo $e->getMessage();
}
.NET
var client = new Client(new Credentials("SMSGLOBAL-API-KEY", "SMSGLOBAL-SECRET-KEY"));
var response = await client.SMS.SMSSend(new {
    origin = "Test",
    destination = "DESTINATION-NUMBER",
    message = "This is a test message"
});

Refer to our REST API documentation for additional parameters to incorporate other functionality like scheduling your message or sending to multiple destinations at once.

Installation

Node.js
SMSGlobal REST API credentials

REST API credentials can be provided in the SMSGlobal client or node environment variables. The credential variables are SMSGLOBAL_API_KEY and SMSGLOBAL_API_SECRET

To install:
npm install --save smsglobal
After installing, require smsglobal in your file:
const apiKey = 'YOUR_API_KEY';
const apiSecret = 'YOUR_API_SECRET';
var smsglobal = require('smsglobal')(apiKey, secret);

All method return promise if no callback is given.

Refer to our SDK on GitHub here for additional information.

PHP
Requirements
  1. PHP 7.2 and above
  2. Guzzle6 (PHP HTTP client)
Installation

To install the PHP client library to your project, we recommend using Composer.

composer require smsglobal/smsglobal-php

Refer to our SDK on GitHub here for additional information.

.NET
Supported .NET versions

This library supports .NET applications written in C#, VB.Net, and F# that utilise .NET Standard 2.1 which supports .NET Core 3.0 and unavailable for .NET Framework. View the supported versions here.

Installation

The best and easiest way to add the SMSGlobal libraries to your .NET project is to use the NuGet package manager.

With Visual Studio IDE

From within Visual Studio, you can use the NuGet GUI to search for and install the SMSGlobal NuGet package. Or, as a shortcut, simply type the following command into the Package Manager Console:

Install-Package SMSGlobal
With .NET Core Command Line Tools

If you are building with the .NET Core command line tools, then you can run the following command from within your project directory:

dotnet add package SMSGlobal
Azure functions

From within Visual Studio while creating azure function app, you can use the NuGet GUI to search for and install the SMSGlobal NuGet package. Or, as a shortcut, simply type the following command into the Package Manager Console:

Install-Package SMSGlobal

More information on NuGet Client Tools can be found here.

Once installed, head over to readme for additional configuration instructions.

Schedule A Demo

Live demonstations of our MXT platform are conducted over Google Meets by our friendly tech support team and generally take 15mins.