Update Message
curl --request PUT \
--url https://staging.api.onenumber.africa/v1/message/{reference} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"recipients": [
{}
],
"message": "<string>",
"expiry": 123,
"deliveryTime": "<string>"
}
'import requests
url = "https://staging.api.onenumber.africa/v1/message/{reference}"
payload = {
"type": "<string>",
"recipients": [{}],
"message": "<string>",
"expiry": 123,
"deliveryTime": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: '<string>',
recipients: [{}],
message: '<string>',
expiry: 123,
deliveryTime: '<string>'
})
};
fetch('https://staging.api.onenumber.africa/v1/message/{reference}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.onenumber.africa/v1/message/{reference}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'recipients' => [
[
]
],
'message' => '<string>',
'expiry' => 123,
'deliveryTime' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging.api.onenumber.africa/v1/message/{reference}"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"recipients\": [\n {}\n ],\n \"message\": \"<string>\",\n \"expiry\": 123,\n \"deliveryTime\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://staging.api.onenumber.africa/v1/message/{reference}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"recipients\": [\n {}\n ],\n \"message\": \"<string>\",\n \"expiry\": 123,\n \"deliveryTime\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.onenumber.africa/v1/message/{reference}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"recipients\": [\n {}\n ],\n \"message\": \"<string>\",\n \"expiry\": 123,\n \"deliveryTime\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 123,
"message": "<string>",
"data": [
{
"reference": "<string>",
"currentStatus": "<string>",
"type": "<string>",
"message": "<string>",
"expiry": "<string>",
"recipients": [
{
"reference": "<string>",
"phoneNumber": "<string>",
"email": "<string>",
"firstName": "<string>",
"lastName": "<string>"
}
],
"statuses": [
{
"name": "<string>",
"createdAt": "<string>"
}
]
}
]
}Message
Update Message
PUT
/
message
/
{reference}
Update Message
curl --request PUT \
--url https://staging.api.onenumber.africa/v1/message/{reference} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"recipients": [
{}
],
"message": "<string>",
"expiry": 123,
"deliveryTime": "<string>"
}
'import requests
url = "https://staging.api.onenumber.africa/v1/message/{reference}"
payload = {
"type": "<string>",
"recipients": [{}],
"message": "<string>",
"expiry": 123,
"deliveryTime": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: '<string>',
recipients: [{}],
message: '<string>',
expiry: 123,
deliveryTime: '<string>'
})
};
fetch('https://staging.api.onenumber.africa/v1/message/{reference}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.onenumber.africa/v1/message/{reference}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'recipients' => [
[
]
],
'message' => '<string>',
'expiry' => 123,
'deliveryTime' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging.api.onenumber.africa/v1/message/{reference}"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"recipients\": [\n {}\n ],\n \"message\": \"<string>\",\n \"expiry\": 123,\n \"deliveryTime\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://staging.api.onenumber.africa/v1/message/{reference}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"recipients\": [\n {}\n ],\n \"message\": \"<string>\",\n \"expiry\": 123,\n \"deliveryTime\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.onenumber.africa/v1/message/{reference}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"recipients\": [\n {}\n ],\n \"message\": \"<string>\",\n \"expiry\": 123,\n \"deliveryTime\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 123,
"message": "<string>",
"data": [
{
"reference": "<string>",
"currentStatus": "<string>",
"type": "<string>",
"message": "<string>",
"expiry": "<string>",
"recipients": [
{
"reference": "<string>",
"phoneNumber": "<string>",
"email": "<string>",
"firstName": "<string>",
"lastName": "<string>"
}
],
"statuses": [
{
"name": "<string>",
"createdAt": "<string>"
}
]
}
]
}Only messages that have these statuses can be updated: created, scheduled.
Request Path Parameters
string
The reference of the Message.
Request Body Parameters
string
required
The type of the Message. This can either be: OTP or SMS.
array
required
The recipients to receive the message. This can contain valid phone numbers and Recipient references.
string
The message to be sent. It is required when type is SMS. If no value is entered (in the case of OTP type), a default 6-digit OTP is generated and sent to the recipients.
int
The expiry time of the message in minutes. This is useful for OTP type messages. If no value is specified, it defaults to 10 minutes.
string
The date and time for message delivery. Use this to schedule messages to be sent later. The accepted time format is: Y-m-d H:i:s. If no value is specified, the message will be sent immediately.
Successful Response Data
int
required
The status of the response. For successful response, value is 201. Check the Response Codes page for details.
string
required
The message of the response.
array
Show properties
Show properties
string
The ID of the Message.
string
The current status of the message.
string
The type of the Message.
string
The message.
string
The expiry date and time of the Message.
array
⌘I
