Skip to content

Transactional Messaging

The attributes API allows you create, send and manage transactional messaging on your integration.

Send Email

Post
bash
https://api.bunce.so/v1/messaging/transactional/send/email

Send Email

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_email string<email> requiredSender Email
sender_name string<email> requiredSender Name
email string<email> requiredRecipient Email
message_type string requiredMessage Type
subject string requiredMessage Subject
text string requiredMessage Text
bash
curl --request POST \
  --url https://api.bunce.so/v1/messaging/transactional/send/email \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: sk_live_************************' \
  --data '{
    "sender_email": "john@example.com",
    "sender_name": "John Doe",
    "email" : "example@gmail.com",
    "message_type" : "otp",
    "subject" : "Reset Password OTP",
    "text" : "Your OTP is 0000"
}'
go
package main

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

func main() {

	url := "http://api.bunce.so/v1/messaging/transactional/send/email"

	payload := strings.NewReader("{\n    \"sender_email\": \"john@example.com\",\n    \"sender_name\": \"John Doe\",\n    \"email\" : \"example@gmail.com\",\n    \"message_type\" : \"otp\",\n    \"subject\" : \"Reset Password OTP\",\n    \"text\" : \"Your OTP is 0000\"\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  = {
  : 'POST',
  : {
    'X-Authorization': 'sk_live_************************',
    'Content-Type': 'application/json',
  },
  : '{"sender_email":"john@example.com","sender_name":"John Doe","email":"example@gmail.com","message_type":"otp","subject":"Reset Password OTP","text":"Your OTP is 0000"}',
}

('https://api.bunce.so/v1/messaging/transactional/send/email', )
  .(() => .())
  .(() => .())
  .(() => .())
php
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
    "sender_email": "john@example.com",
    "sender_name": "John Doe",
    "email" : "example@gmail.com",
    "message_type" : "otp",
    "subject" : "Reset Password OTP",
    "text" : "Your OTP is 0000"
}');

$request->setRequestUrl('https://api.bunce.so/v1/messaging/transactional/send/email');
$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/email"))
    .header("X-Authorization", "sk_live_************************")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n    \"sender_email\": \"john@example.com\",\n    \"sender_name\": \"John Doe\",\n    \"email\" : \"example@gmail.com\",\n    \"message_type\" : \"otp\",\n    \"subject\" : \"Reset Password OTP\",\n    \"text\" : \"Your OTP is 0000\"\n}"))
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

Response

json
{
  "success": true,
  "data": null,
  "message": "Email message sent successfully"
}