Documentation - Callbacks


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

Callbacks - Searching callbacks

You can search for callbacks using our SMS callback API
Below is some sample requests and response. For complete API documentation on searching callbacks 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/search
Method: POST
Request Parameters
Name Location Required Description
Authorization header true Your API token found on the settings page
query body true The search query

Request Example

{
  "filters": [
    [
      {
        "field": "name",
        "operator": "=",
        "value": "John Doe"
      },
      {
        "field": "method",
        "operator": "=",
        "value": "http"
      }
    ],
    [
      {
        "field": "event",
        "operator": "=",
        "value": "sent"
      }
    ]
  ],
  "order_by": [
    {
      "field": "created_at",
      "direction": "desc"
    }
  ],
  "limit": 1,
  "offset": 0
}

Response Examples

Response Code: 200

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

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;

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

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

// Get callback
$callback = $callbackClient->searchCallbacks([
    'filters' => [
        [
            [
                'field'    => 'name',
                'operator' => '=',
                'value'    => 'Test Callback'
            ]
        ],
        [
            [
                'field'    => 'event',
                'operator' => '=',
                'value'    => 'MESSAGE_RECEIVED'
            ]
        ]
    ],
    'order_by' => [
        [
            'field' => 'name',
            'direction' => 'DESC'
        ],
        [
            'field' => 'method',
            'direction' => 'ASC'
        ]
    ],
    'limit'   => 5,
    'offset'  => 5
]);
print_r($callback);

Successful Response

SMSGatewayMe\Client\Model\CallbackSearchResult Object
(
    [count:protected] => 4
    [results:protected] => Array
        (
            [0] => SMSGatewayMe\Client\Model\Callback Object
                (
                    [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
                )

        )

)