Checking SMS Status


SMS Status Retrieval

This API endpoint retrieves the status of a specific SMS message.

Request

Method: GET

URL: https://app.techspace.co.ke/api/v1/sms/status/{message_id}

Replace {message_id} with the actual message ID you want to check. For example: https://app.techspace.co.ke/api/v1/sms/status/7fc033f5-f6dc-4424-95bd-194b41bacbd6

Headers

Header Description Value
api-key The API key provided to authenticate the user. szrgh88Z62Ne828RcXM1sCRbFEfm42St
client-id The client ID associated with the user's API key. F2ikqLLEA9EsmWyTzeEAsjln0avMxTix

Response

The response for this request can be represented as a JSON schema:

Success (200 OK)

{
  "ErrorCode": 0,
  "ErrorDescription": "Success",
  "Data": {
    "MobileNumber": "254740910476",
    "SenderId": "Techspace",
    "Message": "Dear customer, Ksh 43 has been credited to your account no 01xx04. Regards, Kijana Msafi Hotel.",
    "MessageId": "4aac5842-2fa3-4b4b-919b-405eace19a19",
    "Status": "blocked",
    "Channel": "api"
  }
}

Success (200 OK) - Delivered Message

{
  "ErrorCode": 0,
  "ErrorDescription": "Success",
  "Data": {
    "MobileNumber": "254706528249",
    "SenderId": "Kjana_Msafi",
    "Message": "This is a test message.",
    "MessageId": "7fc033f5-f6dc-4424-95bd-194b41bacbd6",
    "Status": "delivered",
    "Channel": "api"
  }
}

Error (404 Not Found)

{
  "ErrorCode": 404,
  "ErrorDescription": "Message not found",
  "Data": null
}

Code Examples

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://app.techspace.co.ke/api/v1/sms/status/7fc033f5-f6dc-4424-95bd-194b41bacbd6',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'api-key: szrgh88Z62Ne828RcXM1sCRbFEfm42St',
    'client-id: F2ikqLLEA9EsmWyTzeEAsjln0avMxTix'
  ),
));

$response = curl_exec($curl);

curl_close($curl);

echo $response;
?>

Node JS

var axios = require('axios');

var config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://app.techspace.co.ke/api/v1/sms/status/7fc033f5-f6dc-4424-95bd-194b41bacbd6',
  headers: { 
    'api-key': 'szrgh88Z62Ne828RcXM1sCRbFEfm42St', 
    'client-id': 'F2ikqLLEA9EsmWyTzeEAsjln0avMxTix'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

Curl

curl --location 'https://app.techspace.co.ke/api/v1/sms/status/7fc033f5-f6dc-4424-95bd-194b41bacbd6' \
--header 'api-key: szrgh88Z62Ne828RcXM1sCRbFEfm42St' \
--header 'client-id: F2ikqLLEA9EsmWyTzeEAsjln0avMxTix'

Javascript

var myHeaders = new Headers();
myHeaders.append("api-key", "szrgh88Z62Ne828RcXM1sCRbFEfm42St");
myHeaders.append("client-id", "F2ikqLLEA9EsmWyTzeEAsjln0avMxTix");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://app.techspace.co.ke/api/v1/sms/status/7fc033f5-f6dc-4424-95bd-194b41bacbd6", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Python

import http.client

conn = http.client.HTTPSConnection("app.techspace.co.ke")
payload = ''
headers = {
  'api-key': 'szrgh88Z62Ne828RcXM1sCRbFEfm42St',
  'client-id': 'F2ikqLLEA9EsmWyTzeEAsjln0avMxTix'
}
conn.request("GET", "/api/v1/sms/status/7fc033f5-f6dc-4424-95bd-194b41bacbd6", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Go Native

package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://app.techspace.co.ke/api/v1/sms/status/7fc033f5-f6dc-4424-95bd-194b41bacbd6"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("api-key", "szrgh88Z62Ne828RcXM1sCRbFEfm42St")
  req.Header.Add("client-id", "F2ikqLLEA9EsmWyTzeEAsjln0avMxTix")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}