Send SMS
Post
bash
https://api.bunce.so/v1/messaging/transactional/send/sms
Send
If successful, your response includes a message that your message has been sent successfully. If there is an error with any of the parameters, it will return a 422 HTTP status code with details in an error object.
Request
Body Parameters required
sender_id string required | Sender ID |
email string<email> nullable | Recipient email. Required if recipient customer_id is not sent |
customer_id string nullable | Recipient Customer ID. Required if recipient email is not sent |
message_type string required | Message Type |
subject string required | Message Subject |
message string required | Message Text |
phone_no string nullable | Recipient phone number. Phone number should be international format. Required if customer does not already exist or does not have a phone number |
bash
curl --request POST \
--url https://api.bunce.so/v1/messaging/transactional/send/sms \
--header 'Content-Type: application/json' \
--header 'X-Authorization: sk_live_************************' \
--data '{
"sender_id": "Bunce",
"email" : "test@gmail.com",
"message_type" : "otp",
"subject" : "Reset Password OTP",
"message" : "This is a message from Bunce",
"phone_no": "+2349088798657"
}'
go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.bunce.so/v1/messaging/transactional/send/sms"
payload := strings.NewReader("{\n \"sender_id\": \"Bunce\",\n \"email\" : \"test@gmail.com\",\n \"message_type\" : \"otp\",\n \"subject\" : \"Reset Password OTP\",\n \"message\" : \"This is a message from Bunce\",\n \"phone_no\": \"+2349088798657\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Authorization", "sk_live_************************")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
js
const = ('node-fetch')
let = 'https://api.bunce.so/v1/messaging/transactional/send/sms'
let = {
: 'POST',
: {
'X-Authorization': 'sk_live_************************',
'Content-Type': 'application/json',
},
: '{"sender_id":"Bunce","email":"test@gmail.com","message_type":"otp","subject":"Reset Password OTP","message":"This is a message from Bunce","phone_no":"+2349088798657"}',
}
(, )
.then(() => .json())
.then(() => .())
.catch(() => .('error:' + ))
php
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{
"sender_id": "Bunce",
"email" : "test@gmail.com",
"message_type" : "otp",
"subject" : "Reset Password OTP",
"message" : "This is a message from Bunce",
"phone_no": "+2349088798657"
}');
$request->setRequestUrl('https://api.bunce.so/v1/messaging/transactional/send/sms');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'X-Authorization' => 'sk_live_************************',
'Content-Type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
java
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.bunce.so/v1/messaging/transactional/send/sms"))
.header("X-Authorization", "sk_live_************************")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"sender_id\": \"Bunce\",\n \"email\" : \"test@gmail.com\",\n \"message_type\" : \"otp\",\n \"subject\" : \"Reset Password OTP\",\n \"message\" : \"This is a message from Bunce\",\n \"phone_no\": \"+2349088798657\"\n}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response
json
{
"success": true,
"data": null,
"message": "SMS message sent successfully"
}