Documentation - Callbacks


  1. Creating a new callback
  2. Updating an existing callback
  3. Getting a callbacks information
  4. Searching callbacks

Callbacks - Creating a new callback

You can create new callbacks on SMS gateway using the callback API.
Below is some sample requests and response. For complete API documentation on creating a new callback please refer to the Swagger (Open API Specification) documentations here: SMS Gateway API Definition


API Request

Request Endpoint
Endpoint: https://smsgateway.me/api/v4/callback
Method: POST
Request Parameters
Name Location Required Description
Authorization header true Your API token found on the settings page
callback body true JSON payload with the information of callback the API should create

Request Example

{
  "name": "HTTP Callback",
  "event": "received",
  "device_id": 1,
  "filter_type": "contains",
  "filter": "stop",
  "method": "http",
  "action": "http://mywebsite/sms-gateway-me-hook",
  "secret": "super-secret"
}

Response Examples

Response Code: 200

{
  "id": 1,
  "name": "HTTP Callback",
  "event": "received",
  "device_id": 1,
  "filter_type": "contains",
  "filter": "stop",
  "method": "http",
  "action": "http://mywebsite/sms-gateway-me-hook",
  "secret": "super-secret"
}

Error Response

When a request can not be processed

Response Code: 40x | 500

{
  "status": "fail",
  "message": "Could not process request",
  "data": {
    "exception": "Error message"
  }
}

SDK Examples

You can use our Swagger generated PHP SDK to help integrate with our service. If you wish to use SMS Gateway Me with a different platform you may generate your own client using the swagger file.

Installation Instructions: PHP SMS Gateway SDK
Swagger Definition: SMS Gateway API Definition


Request Example

<?php

require 'vendor/autoload.php';

use SMSGatewayMe\Client\ApiClient;
use SMSGatewayMe\Client\Configuration;
use SMSGatewayMe\Client\Api\CallbackApi;
use SMSGatewayMe\Client\Model\CreateCallbackRequest;

// Configure client
$config = Configuration::getDefaultConfiguration();
$config->setApiKey('Authorization', 'your-token-here');
$apiClient = new ApiClient($config);

// Create callback client
$callbackClient = new CallbackApi($apiClient);

/**
 * Create Callback Request
 * For valid events, filter types and methods please view the swagger definition
 */
$createCallbackRequest = new CreateCallbackRequest([
    'name' => 'Test Callback',
    'event' => 'MESSAGE_RECEIVED',
    'deviceId' => 123456,
    'filterType' => 'contains',
    'filter' => 'hello',
    'method' => 'HTTP',
    'action' => 'http://mywebsite.com/sms-callback.php',
    'secret' => 'SsshhhhNotASecret'
]);

$callback = $callbackClient->createCallback($createCallbackRequest);
print_r($callback);

Successful Response

(
    [id:protected] => 17721
    [name:protected] => Test Callback
    [event:protected] => MESSAGE_RECEIVED
    [deviceId:protected] => 123456
    [filterType:protected] => contains
    [filter:protected] => hello
    [method:protected] => HTTP
    [action:protected] => http://mywebsite.com/sms-callback.php
    [secret:protected] => SsshhhhNotASecret
)