The Teleos.in API allows you to send SMS messages through your Android device as a gateway. To use this API, you must :
https://teleos.in/sms-login/services/send.php?key=YOUR_API_KEY&number=0608918217&message=This+message&devices=%5B%22182%7C0%22%2C%22182%7C1%22%5D&type=sms&prioritize=0
fetch('https://teleos.in/sms-login/services/send.php?key=YOUR_API_KEY&number=0608918217&message=This%20message&devices=%5B%22182%7C0%22%2C%22182%7C1%22%5D&type=sms&prioritize=0')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
curl -X GET "https://teleos.in/sms-login/services/send.php?key=YOUR_API_KEY&number=0608918217&message=This+message&devices=%5B%22182%7C0%22%2C%22182%7C1%22%5D&type=sms&prioritize=0"
<?php
$response = file_get_contents("https://teleos.in/sms-login/services/send.php?key=YOUR_API_KEY&number=0608918217&message=This+message&devices=%5B%22182%7C0%22%2C%22182%7C1%22%5D&type=sms&prioritize=0");
$data = json_decode($response, true);
print_r($data);
?>
import React, { useEffect, useState } from 'react';
function App() {
const [data, setData] = useState(null);
useEffect(() => {
fetch('https://teleos.in/sms-login/services/send.php?key=YOUR_API_KEY&number=0608918217&message=This%20message&devices=%5B%22182%7C0%22%2C%22182%7C1%22%5D&type=sms&prioritize=0')
.then(response => response.json())
.then(data => setData(data))
.catch(error => console.error('Error:', error));
}, []);
return <div>{data && JSON.stringify(data)}</div>;
}
export default App;
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main(string[] args) {
using HttpClient client = new HttpClient();
string url = "https://teleos.in/sms-login/services/send.php?key=YOUR_API_KEY&number=0608918217&message=This+message&devices=%5B%22182%7C0%22%2C%22182%7C1%22%5D&type=sms&prioritize=0";
HttpResponseMessage response = await client.GetAsync(url);
string result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
import requests
url = "https://teleos.in/sms-login/services/send.php"
params = {
"key": "YOUR_API_KEY",
"number": "0608918217",
"message": "This message",
"devices": '["182|0","182|1"]',
"type": "sms",
"prioritize": 0
}
response = requests.get(url, params=params)
print(response.json())
import java.io.*;
import java.net.*;
public class TeleosApi {
public static void main(String[] args) throws Exception {
String urlStr = "https://teleos.in/sms-login/services/send.php?key=YOUR_API_KEY&number=0608918217&message=This+message&devices=%5B%22182%7C0%22%2C%22182%7C1%22%5D&type=sms&prioritize=0";
URL url = new URL(urlStr);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
System.out.println(content.toString());
}
}
{
"success": true,
"data": {
"messages": [
{
"ID": 296180,
"number": "0608918217",
"message": "This message",
"deviceID": 182,
"simSlot": 0,
"schedule": null,
"userID": 1,
"groupID": "DEGxMhxJiQUpU9F6nY671d682d63d9e2.96844762",
"status": "Pending",
"resultCode": null,
"errorCode": null,
"type": "sms",
"attachments": null,
"prioritize": false,
"retries": null,
"sentDate": "2024-10-26T23:07:41+0100",
"deliveredDate": null,
"expiryDate": null
}
]
},
"error": null
}
{
"success": false,
"data": null,
"error": {
"code": 401,
"message": "This API key is invalid."
}
}
{
"success": true,
"data": {
"credits": null
},
"error": null
}
GET https://teleos.in/sms-login/services/get-msgs.php?key=dcf65ee699fe13eec2baaf06d1cfb6826e150a0d&status=Received
curlA https://teleos.in/services/get-msgs.php?key=dcf65ee699fe13eec2baaf06d1cfb6826e150a0d&status=Received
$url = "https://teleos.in/services/get-msgs.php?key=dcf65ee699fe13eec2baaf06d1cfb6826e150a0d&status=Received";
$response = file_get_contents($url);
echo $response;
fetch("https://teleos.in/services/get-msgs.php?key=dcf65ee699fe13eec2baaf06d1cfb6826e150a0d&status=Received")
.then(response => response.json())
.then(data => console.log(data));
import requests
url = "https://teleos.in/services/get-msgs.php"
params = {
"key": "dcf65ee699fe13eec2baaf06d1cfb6826e150a0d",
"status": "Received"
}
response = requests.get(url, params=params)
print(response.json())
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var url = "https://teleos.in/services/get-msgs.php?key=dcf65ee699fe13eec2baaf06d1cfb6826e150a0d&status=Received";
using var client = new HttpClient();
var response = await client.GetStringAsync(url);
Console.WriteLine(response);
}
}
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class GetMessageStatus {
public static void main(String[] args) throws Exception {
String url = "https://teleos.in/services/get-msgs.php?key=dcf65ee699fe13eec2baaf06d1cfb6826e150a0d&status=Received";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
System.out.println(content.toString());
}
}
{
"success": true,
"data": {
"messages": [
{
"ID": 296180,
"number": "0608918217",
"message": "This message",
"deviceID": 182,
"status": "Delivered",
// Additional fields...
}
]
},
"error": null
}
{
"success": false,
"data": null,
"error": {
"code": 401,
"message": "This API key is invalid."
}
}
This documentation provides an overview of setting up and handling webhooks for TELEOS SMS gateway, allowing developers to receive and respond to events like incoming messages or USSD requests. Webhooks can be configured and managed in the TELEOS SMS gateway Webhook Management.
Webhooks in Teleos let you automatically trigger specific actions when events occur, like receiving an SMS message or a USSD request on your connected Android device. You can set up a URL endpoint on your server that Teleos can call, delivering event data in real-time. This integration makes it easy to automate responses or trigger workflows based on the incoming data.
1. Webhook URL: You'll need an endpoint on your server to receive TELEOS SMS gateway webhook requests.
2. API Key: Define your unique API_KEY for hashing signatures. This key will authenticate incoming requests to ensure security.
Each webhook request contains a signature in the HTTP_X_SG_SIGNATURE header to verify the request authenticity. Use your API_KEY to hash the message content and compare it against this signature.
Here is a PHP example to help developers get started with TELEOS SMS gateway Webhooks. This script listens for incoming SMS messages and USSD requests, verifies the signature, and processes the data.
<?php
// Replace with your API Key
define("API_KEY", "dcf65ee699fe13eec2baaf06d1cfb6826e150a0d");
try {
if (isset($_SERVER["HTTP_X_SG_SIGNATURE"])) {
// Handling incoming SMS messages
if (isset($_POST["messages"])) {
$hash = base64_encode(hash_hmac('sha256', $_POST["messages"], API_KEY, true));
if ($hash === $_SERVER["HTTP_X_SG_SIGNATURE"]) {
$messages = json_decode($_POST["messages"], true);
foreach ($messages as $message) {
// Check if message content is "hi" and respond
if (strtolower($message["message"]) === "hi") {
// You can respond using an API call here, for example:
// sendReply($message["number"], "Hello! How can I help you?");
}
}
} else {
throw new Exception("Signature doesn't match!");
}
}
// Handling USSD requests
else if (isset($_POST["ussdRequest"])) {
$hash = base64_encode(hash_hmac('sha256', $_POST["ussdRequest"], API_KEY, true));
if ($hash === $_SERVER["HTTP_X_SG_SIGNATURE"]) {
$ussdRequest = json_decode($_POST["ussdRequest"]);
$deviceID = $ussdRequest->deviceID;
$simSlot = $ussdRequest->simSlot;
$request = $ussdRequest->request;
$response = $ussdRequest->response;
// Perform actions based on USSD data
} else {
throw new Exception("Signature doesn't match!");
}
}
} else {
http_response_code(400);
error_log("Signature not found!");
}
} catch (Exception $e) {
http_response_code(401);
error_log($e->getMessage());
}
?>
The webhook receives SMS messages in the messages array, where each message has the following structure:
USSD requests have the following fields:
This concludes the TELEOS SMS gateway Webhook documentation, providing developers with the necessary information to set up and handle TELEOS SMS gateway webhooks.
For any additional questions, technical support, or feature requests, please don't hesitate to reach out. We're here to assist you in making the most of your TELEOS SMS gateway experience!