Start Receiving Subscriber Data
Receive subscriber information from SMS MO (Mobile Originated) messages and monitor full lifecycle subscription events, including activations, renewals, and deactivations
Authentication
Find your API token for each account in Settings => Security on the 9bits Customer Dashboard.
The token is sent in the Authorization
header of each endpoint preceded by Bearer
. It's required for all requests made to the VAS API such as accessing reports.
SMS MO
Every SMS MO received from subscriber will be routed to the partner. This example is written in Python.
import requests
url = f"{{ client_url }}"
# Define the payload data in a Python dictionary
data = {
"type": "sms"
"telco": "mtn",
"from": "2348020000000",
"to": "48974",
"message": "games28",
"product_id": "103",
"sent_date": "2024-01-02 23:50:37"
}
# Define headers with authorization and content type
headers = {
"Authorization": f"Bearer {api_token}",
"Content-Type": "application/json"
}
# Send the POST request
response = requests.post(url, json=data, headers=headers)
# Check the response
if response.status_code == 200:
print("Request was successful.")
print(response.json())
else:
print(f"Request failed with status code: {response.status_code}")
print(response.text)
Activation
Every activation sync data received from the MNO will be routed to the partner. This example is written in Python.
import requests
url = f"{{ client_url }}"
# Define the payload data in a Python dictionary
data = {
"type": "activation_notification"
"telco": "mtn",
"product_id": "103",
"product_name": "games_daily",
"phone": "2348020000000",
"fee": 20000,
"auto_renewal": false,
"date": "2024-01-02 23:50:37"
}
# Define headers with authorization and content type
headers = {
"Authorization": f"Bearer {api_token}",
"Content-Type": "application/json"
}
# Send the POST request
response = requests.post(url, json=data, headers=headers)
# Check the response
if response.status_code == 200:
print("Request was successful.")
print(response.json())
else:
print(f"Request failed with status code: {response.status_code}")
print(response.text)
Renewal
Every renewal sync data received from the MNO will be routed to the partner. This example is written in Python.
import requests
url = f"{{ client_url }}"
# Define the payload data in a Python dictionary
data = {
"type": "renewal_notification"
"telco": "mtn",
"product_id": "103",
"product_name": "games_daily",
"phone": "2348020000000",
"fee": 20000,
"auto_renewal": true,
"date": "2024-01-02 23:50:37"
}
# Define headers with authorization and content type
headers = {
"Authorization": f"Bearer {api_token}",
"Content-Type": "application/json"
}
# Send the POST request
response = requests.post(url, json=data, headers=headers)
# Check the response
if response.status_code == 200:
print("Request was successful.")
print(response.json())
else:
print(f"Request failed with status code: {response.status_code}")
print(response.text)
Deactivation
Every deactivation sync data received from the MNO will be routed to the partner. This example is written in Python.
import requests
url = f"{{ client_url }}"
# Define the payload data in a Python dictionary
data = {
"type": "deactivation_notification"
"telco": "mtn",
"product_id": "103",
"product_name": "games_daily",
"phone": "2348020000000",
"auto_renewal": false,
"date": "2024-01-02 23:50:37"
}
# Define headers with authorization and content type
headers = {
"Authorization": f"Bearer {api_token}",
"Content-Type": "application/json"
}
# Send the POST request
response = requests.post(url, json=data, headers=headers)
# Check the response
if response.status_code == 200:
print("Request was successful.")
print(response.json())
else:
print(f"Request failed with status code: {response.status_code}")
print(response.text)
SMS REST formats and conventions
JSON
JSON (appplication/json) is the content type of both requests and responses unless otherwise specified.
Last updated