Overview

Get singleton instance

The singleton instance of the MessageController class can be accessed from the API Client.

MessageController message = client.Message;
MessageController messageController = client.getMessage();
Message* message  = [[Message alloc]init]();
MessageController messageController = client.getMessage();
$messageController = $client->getMessage();
message_controller = client.message
message_controller = client.message
var app = angular.module('myApp', ['Releans']);
app.controller('testController', MessageController);

function MessageController($scope,
    MessageController) {
}
const lib = require('lib');
const controller = lib.MessageController;

Send SMS Message

Send a single message.

POST /message/send
CreateSendSMSMessageAsync(string senderId, string mobileNumber, string message)
void createSendSMSMessageAsync(
    final String senderId,
    final String mobileNumber,
    final String message,
    final APICallBack callBack)
function createSendSMSMessageAsyncWithSenderId:(NSString*) senderId
                mobileNumber:(NSString*) mobileNumber
                message:(NSString*) message
                completionBlock:(CompletedPostSendSMSMessage) onCompleted:(senderId mobileNumber : mobileNumber message : message )
void createSendSMSMessageAsync(
    final String senderId,
    final String mobileNumber,
    final String message,
    final APICallBack callBack)
function createSendSMSMessage(
    $senderId,
    $mobileNumber,
    $message)
def create_send_sms_message(self,
                                sender_id,
                                mobile_number,
                                message)
def create_send_sms_message(sender_id,
                                mobile_number,
                                message)
createSendSMSMessage(senderId, mobileNumber, message)
createSendSMSMessage(senderId, mobileNumber, message)

Parameter Type Description
senderId
Required
string Sender id to send the message from.
mobileNumber
Required
string The mobile number supposed to receive the message.
message
Required
string Message text.
Complete File code

Show complete file for code, with bootstrap and error handling included.

curl -X POST \
  --url 'https://platform.releans.com/api/message/send' \
  -H 'Authorization: Bearer Your_API_Key'\
  -d 'senderId=senderId4' \
  -d 'mobileNumber=mobileNumber8' \
  -d 'message=message0'
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;

using Releans;
using Releans.Utilities;
using Releans.Models;
using Releans.Controllers;
using Releans.Exceptions;
using System.IO;

namespace Testing
{
    class Program {
        static void Main(string[] args){
            Configuration.OAuthAccessToken = "Your_API_Key";
            ReleansClient client = new ReleansClient();
            MessageController message = client.Message;

            string senderId = "senderId4";
            string mobileNumber = "mobileNumber8";
            string message = "message0";

            try
            {
                string result = message.CreateSendSMSMessageAsync(senderId, mobileNumber, message).Result;
            }
            catch (APIException e){};
        }
    }
}
package com.example;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import java.util.*;
import java.io.*;

import Releans.*;
import Releans.models.*;
import Releans.controllers.*;
import Releans.http.client.*;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Configuration.oAuthAccessToken = "Your_API_Key";
        ReleansClient client = new ReleansClient();
        MessageController messageController = client.getMessage();

        String senderId = "senderId4";
        String mobileNumber = "mobileNumber8";
        String message = "message0";

        messageController.createSendSMSMessageAsync(senderId, mobileNumber, message, new APICallBack() {
            public void onSuccess(HttpContext context, String response) {
                // TODO success callback handler
            }
            public void onFailure(HttpContext context, Throwable error) {
                // TODO failure callback handler
            }
        });
    }
}
#import 
#import Message.h



Message* message  = [[Message alloc]init]();

senderId = @'senderId4';
mobileNumber = @'mobileNumber8';
message = @'message0';

@try {
    [message createSendSMSMessageAsyncWithSenderId: senderId mobileNumber : mobileNumber message : message  completionBlock:^(BOOL success, HttpContext* context, NSString* response, NSError* error){
    if(error!=null)
        // Handle error
    else
        NSString* = response;
}];}
} @catch (APIError * exception) {
    NSLog (@"Caught APIException:%@ %@", exception.reason);
}
package com.example;

import java.util.*;
import java.io.*;

import Releans.*;
import Releans.models.*;
import Releans.controllers.*;
import Releans.http.client.*;

public class Program {

    public static void main(String[] args) {
        Configuration.oAuthAccessToken = "Your_API_Key";
        ReleansClient client = new ReleansClient();
        MessageController messageController = client.getMessage();

        String senderId = "senderId4";
        String mobileNumber = "mobileNumber8";
        String message = "message0";

        messageController.createSendSMSMessageAsync(senderId, mobileNumber, message, new APICallBack() {
            public void onSuccess(HttpContext context, String response) {
                // TODO success callback handler
            }
            public void onFailure(HttpContext context, Throwable error) {
                // TODO failure callback handler
            }
        });
    }
}
require_once "vendor/autoload.php";

use ReleansLib\Models;
use ReleansLib\Exceptions;

$oAuthAccessToken = 'Your_API_Key';

$client = new ReleansLib\ReleansClient($oAuthAccessToken);

$messageController = $client->getMessage();

$senderId = 'senderId4';
$mobileNumber = 'mobileNumber8';
$message = 'message0';

try {
    $result = $messageController->createSendSMSMessage($senderId, $mobileNumber, $message);
} catch (ReleansLib\APIException $e) {
    echo 'Caught APIException: ',  $e->getMessage(), "\n";
}
from releans.releans import Releans
from releans.exceptions.api_exception import APIException

o_auth_access_token = 'Your_API_Key'

client = ReleansClient(o_auth_access_token)



message_controller = client.message
sender_id = 'senderId4'
mobile_number = 'mobileNumber8'
message = 'message0'

try:
    result = message_controller.create_send_sms_message(sender_id, mobile_number, message)
except APIException as e:
    print(e)
require 'releans'

include Releans

o_auth_access_token = 'Your_API_Key'

client = Releans.new(o_auth_access_token: o_auth_access_token)

message_controller = client.message
sender_id = 'senderId4'
mobile_number = 'mobileNumber8'
message = 'message0'

begin
  result = message_controller.create_send_sms_message(sender_id, mobile_number, message)
rescue APIException => ex
  puts "Caught APIException: #{ex.message}"
end
'use strict';

var app = angular.module('myApp', ['Releans']);
app.controller('testController', MessageController);

function MessageController($scope,
    Configuration,
    MessageController) {

Configuration.oAuthAccessToken = 'Your_API_Key';

    var senderId = 'senderId4';
    var mobileNumber = 'mobileNumber8';
    var message = 'message0';

    var result = MessageController.createSendSMSMessage(senderId, mobileNumber, message);
    result.then(function(response) {
        // this block will be executed on successful endpoint call
        // `response.body` will be of type 'string'
    }, function(err) {
        // this block will be executed on endpoint call failure
    });
}
'use strict';

const lib = require('lib');
const configuration = lib.Configuration;
const controller = lib.MessageController;

configuration.oAuthAccessToken = 'Your_API_Key';

let senderId = 'senderId4';
let mobileNumber = 'mobileNumber8';
let message = 'message0';

const promise = controller.createSendSMSMessage(senderId, mobileNumber, message);
promise.then((response) => {
    // this block will be executed on successful endpoint call
    // `response` will be of type 'string'
}, (err) => {
    // this block will be executed on endpoint call failure
    // `err` is an 'object' containing more information about the error
});

Get All Messages

List all messages sent by the account.

curl -X GET \
  --url 'https://platform.releans.com/api/message' \
  -H 'Authorization: Bearer Your_API_Key'\
  -H 'Accept: application/json'
try
{
    dynamic result = message.GetAllMessagesAsync().Result;
}
catch (APIException e){};
messageController.getAllMessagesAsync(new APICallBack() {
    public void onSuccess(HttpContext context, DynamicResponse response) {
        // TODO success callback handler
    }
    public void onFailure(HttpContext context, Throwable error) {
        // TODO failure callback handler
    }
});
[message getAllMessagesWithCompletionBlock:  ^(BOOL success, HttpContext* context, id response, NSError* error){
    if(error!=null)
        // Handle error
    else
        id = response;
}];}
messageController.getAllMessagesAsync(new APICallBack() {
    public void onSuccess(HttpContext context, DynamicResponse response) {
        // TODO success callback handler
    }
    public void onFailure(HttpContext context, Throwable error) {
        // TODO failure callback handler
    }
});
$result = $messageController->getAllMessages();
result = message_controller.get_all_messages()
result = message_controller.get_all_messages()
var result = MessageController.getAllMessages();
result.then(function(response) {
    // this block will be executed on successful endpoint call
    // `response.body` will be of type 'mixed'
}, function(err) {
    // this block will be executed on endpoint call failure
});
const promise = controller.getAllMessages();
promise.then((response) => {
    // this block will be executed on successful endpoint call
    // `response` will be of type 'mixed'
}, (err) => {
    // this block will be executed on endpoint call failure
    // `err` is an 'object' containing more information about the error
});

Get Price of Message

Return cost of sending a message to the number.

curl -X GET -G \
  --url 'https://platform.releans.com/api/message/price' \
  -H 'Authorization: Bearer Your_API_Key' \
  -d 'mobileNumber=mobileNumber8'
string mobileNumber = "mobileNumber8";

try
{
    string result = message.GetPriceOfMessageAsync(mobileNumber).Result;
}
catch (APIException e){};
String mobileNumber = "mobileNumber8";

messageController.getPriceOfMessageAsync(mobileNumber, new APICallBack() {
    public void onSuccess(HttpContext context, String response) {
        // TODO success callback handler
    }
    public void onFailure(HttpContext context, Throwable error) {
        // TODO failure callback handler
    }
});
mobileNumber = @'mobileNumber8';

[message getPriceOfMessageAsyncWithMobileNumber: mobileNumber  completionBlock:^(BOOL success, HttpContext* context, NSString* response, NSError* error){
    if(error!=null)
        // Handle error
    else
        NSString* = response;
}];}
String mobileNumber = "mobileNumber8";

messageController.getPriceOfMessageAsync(mobileNumber, new APICallBack() {
    public void onSuccess(HttpContext context, String response) {
        // TODO success callback handler
    }
    public void onFailure(HttpContext context, Throwable error) {
        // TODO failure callback handler
    }
});
$mobileNumber = 'mobileNumber8';

$result = $messageController->getPriceOfMessage($mobileNumber);
mobile_number = 'mobileNumber8'

result = message_controller.get_price_of_message(mobile_number)
mobile_number = 'mobileNumber8'

result = message_controller.get_price_of_message(mobile_number)
var mobileNumber = 'mobileNumber8';

var result = MessageController.getPriceOfMessage(mobileNumber);
result.then(function(response) {
    // this block will be executed on successful endpoint call
    // `response.body` will be of type 'string'
}, function(err) {
    // this block will be executed on endpoint call failure
});
let mobileNumber = 'mobileNumber8';

const promise = controller.getPriceOfMessage(mobileNumber);
promise.then((response) => {
    // this block will be executed on successful endpoint call
    // `response` will be of type 'string'
}, (err) => {
    // this block will be executed on endpoint call failure
    // `err` is an 'object' containing more information about the error
});

Parameter Type Description
mobileNumber
Required
string Mobile number you want to know the price of sending a message.

View Message

Return the details of the message.

curl -X GET -G \
  --url 'https://platform.releans.com/api/message/view' \
  -H 'Authorization: Bearer Your_API_Key'\
  -H 'Accept: application/json' \
  -d 'id=id0'
string id = "id0";

try
{
    dynamic result = message.GetViewMessageAsync(id).Result;
}
catch (APIException e){};
String id = "id0";

messageController.getViewMessageAsync(id, new APICallBack() {
    public void onSuccess(HttpContext context, DynamicResponse response) {
        // TODO success callback handler
    }
    public void onFailure(HttpContext context, Throwable error) {
        // TODO failure callback handler
    }
});
mid = @'id0';

[message getViewMessageAsyncWithId: mid  completionBlock:^(BOOL success, HttpContext* context, id response, NSError* error){
    if(error!=null)
        // Handle error
    else
        id = response;
}];}
String id = "id0";

messageController.getViewMessageAsync(id, new APICallBack() {
    public void onSuccess(HttpContext context, DynamicResponse response) {
        // TODO success callback handler
    }
    public void onFailure(HttpContext context, Throwable error) {
        // TODO failure callback handler
    }
});
$id = 'id0';

$result = $messageController->getViewMessage($id);
id = 'id0'

result = message_controller.get_view_message(id)
id = 'id0'

result = message_controller.get_view_message(id)
var id = 'id0';

var result = MessageController.getViewMessage(id);
result.then(function(response) {
    // this block will be executed on successful endpoint call
    // `response.body` will be of type 'mixed'
}, function(err) {
    // this block will be executed on endpoint call failure
});
let id = 'id0';

const promise = controller.getViewMessage(id);
promise.then((response) => {
    // this block will be executed on successful endpoint call
    // `response` will be of type 'mixed'
}, (err) => {
    // this block will be executed on endpoint call failure
    // `err` is an 'object' containing more information about the error
});

Parameter Type Description
id
Required
string Id of the message you need to return its details.