Scheduled Messages

Schedule messages to be sent for later.


The easiest way to use Omnichannel API is with our official libraries. Libraries will take care of authentication, request validation and response handling.

Schedule a message

Send a message with time_to_send parameter to schedule it for later. Learn how to compose a message in our quickstart guide.

omnimessage = Omnimessage(
  to="RECIPIENT_PHONE_NUMBER",
  time_to_send="date in ISO-8061 format",
  messages=(sms, viber))
const omnimessage = MessenteApi.Omnimessage.constructFromObject({
  messages: [viber, sms],
  to: "phone number in international format",
  time_to_send: "date in ISO-8061 format"
});
<?php
$omnimessage = new Omnimessage([
  "to" => "RECIPIENT_PHONE_NUMBER",
  "dlr_url" => "YOUR_WEBHOOK_URL",
  "time_to_send" => "date in ISO-8061 format"]);
?>
omnimessage.setTimeToSend("date in ISO-8061 format");
omnimessage.time_to_send = 'date in ISO-8061 format'
var omnimessage = new Omnimessage(
  to: "RECIPIENT_PHONE_NUMBER",
  time_to_send="date in ISO-8061 format",
  messages: messages);
curl -X POST \
  'https://api.messente.com/v1/omnimessage' \
  -u MESSENTE_API_USERNAME:MESSENTE_API_PASSWORD \
  -H "Content-Type: application/json" \
  -d '{
    "to": "RECIPIENT_PHONE_NUMBER",
    "time_to_send": "date in ISO-8061 format",
    "messages": [
      {
        "channel": "sms",
        "sender": "<sender name (optional)>",
        "text": "hello sms"
      }
    ]
  }'

Time Formatting

  • Time must be specified in the ISO 8601 format.
  • Default timezone is UTC.

Both of these cases are allowed:

  1. 2019-06-22T09:05 - UTC is set as timezone
  2. 2019-06-22T09:05:07+04:00 - Default timezone is ignored and UTC+4 is used

Cancel a scheduled message

To cancel a scheduled message you need to know the omnimessage_id that you got when you sent out the message.

# pip install messente-api

from messente_api import ApiClient, Configuration, OmnimessageApi
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api_instance = OmnimessageApi(ApiClient(configuration))
omnimessage_id = "YOUR_OMNIMESSAGE_ID"

try:
    api_instance.cancel_scheduled_message(omnimessage_id)
except ApiException as e:
    print("Exception when calling cancel_scheduled_message: %s\n" % e)
// npm i messente_api

const MessenteApi = require('messente_api');

const defaultClient = MessenteApi.ApiClient.instance;
const basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR_MESSENTE_API_USERNAME';
basicAuth.password = 'YOUR_MESSENTE_API_PASSWORD';

const api = new MessenteApi.OmnimessageApi();
const omnimessage_id = 'YOUR_OMNIMESSAGE_ID';

api.cancelScheduledMessage(omnimessage_id, (error, _) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully');
  }
});
<?php

// composer require messente/messente-api-php

require_once __DIR__.'/vendor/autoload.php';

use Messente\Api\Api\OmnimessageApi;
use Messente\Api\Configuration;

$config = Configuration::getDefaultConfiguration()
    ->setUsername('YOUR_MESSENTE_API_USERNAME')
    ->setPassword('YOUR_MESSENTE_API_PASSWORD');

$apiInstance = new OmnimessageApi(
    new GuzzleHttp\Client(),
    $config
);

$omnimessage_id = 'YOUR_OMNIMESSAGE_ID';

try {
    $apiInstance->cancelScheduledMessage($omnimessage_id);
} catch (Exception $e) {
    echo 'Exception when calling cancelScheduledMessage: ', $e->getMessage(), PHP_EOL;
}
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.OmnimessageApi;
import com.messente.auth.HttpBasicAuth;

// repositories { jcenter() }
// dependencies { implementation 'com.messente.api:messente-api' }

public class Main {
    public static void main(String[] args) {
        ApiClient apiClient = new ApiClient();

        HttpBasicAuth basicAuth = (HttpBasicAuth) apiClient.getAuthentication("basicAuth");
        basicAuth.setUsername("YOUR_MESSENTE_API_USERNAME");
        basicAuth.setPassword("YOUR_MESSENTE_API_PASSWORD");

        String omnimessageId = "YOUR_OMNIMESSAGE_ID";

        OmnimessageApi apiInstance = new OmnimessageApi(apiClient);

        try {
            apiInstance.cancelScheduledMessage(omnimessageId);
        } catch (ApiException e) {
            System.err.println(e.getResponseBody());
        }
    }
}
# gem install messente_api

require 'messente_api'

MessenteApi.configure do |config|
  config.username = 'YOUR_MESSENTE_API_USERNAME'
  config.password = 'YOUR_MESSENTE_API_PASSWORD'
end

api_instance = MessenteApi::OmnimessageApi.new
ominmessage_id = 'YOUR_OMNIMESSAGE_ID'

begin
  api_instance.cancel_scheduled_message(ominmessage_id)
rescue MessenteApi::ApiError => e
  puts "Exception when calling cancel_scheduled_message: #{e}"
end
// PM > Install-Package com.Messente.Api

using System;
using System.Diagnostics;
using com.Messente.Api.Api;
using com.Messente.Api.Client;

namespace Example
{
    public class SendOmniMessageExample
    {
        public static void Main()
        {
            Configuration conf = new Configuration();
            conf.Username = "YOUR_MESSENTE_API_USERNAME";
            conf.Password = "YOUR_MESSENTE_API_PASSWORD";
            var apiInstance = new OmnimessageApi(conf);
            var omnimessageId = "YOUR_OMNIMESSAGE_ID";

            try
            {
                apiInstance.CancelScheduledMessage(omnimessageId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CancelScheduledMessage: " + e.Message);
            }
        }
    }
}
curl https://api.messente.com/v1/omnimessage/YOUR_OMNIMESSAGE_ID \
  -u MESSENTE_API_USERNAME:MESSENTE_API_PASSWORD \
  -X 'DELETE'