Documentation - Callbacks


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

Callbacks - Updating an existing callback

You can update an existing callback on SMS gateway using the callback API.
Below is some sample requests and response. For complete API documentation on updating an existing 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/{id}
Method: PUT
Request Parameters
Name Location Required Description
Authorization header true Your API token found on the settings page
id path true The id of the callback the API should update
callback body true JSON payload with the information of callbacks the API should create

Request Example

{
  "name": "HTTP Callback",
  "event": "MESSAGE_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": "sent",
  "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\UpdateCallbackRequest;

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

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

/**
 * Update Callback Request
 * For valid events, filter types and methods please view the swagger definition
 */
$updateCallbackRequest = new UpdateCallbackRequest([
    '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->updateCallback(17728, $updateCallbackRequest);
print_r($callback);

Successful Response

SMSGatewayMe\Client\Model\Callback Object
(
    [id:protected] => 17728
    [name:protected] => Test Callback 1
    [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
)