Preview a template version
curl --request POST \
--url https://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"locales": [
"es",
"en"
],
"payload": {
"onboarding_url": "https://app.maihuego.com/onboarding/abc"
}
}
'import requests
url = "https://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview"
payload = {
"locales": ["es", "en"],
"payload": { "onboarding_url": "https://app.maihuego.com/onboarding/abc" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
locales: ['es', 'en'],
payload: {onboarding_url: 'https://app.maihuego.com/onboarding/abc'}
})
};
fetch('https://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview', 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://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'locales' => [
'es',
'en'
],
'payload' => [
'onboarding_url' => 'https://app.maihuego.com/onboarding/abc'
]
]),
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://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview"
payload := strings.NewReader("{\n \"locales\": [\n \"es\",\n \"en\"\n ],\n \"payload\": {\n \"onboarding_url\": \"https://app.maihuego.com/onboarding/abc\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"locales\": [\n \"es\",\n \"en\"\n ],\n \"payload\": {\n \"onboarding_url\": \"https://app.maihuego.com/onboarding/abc\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"locales\": [\n \"es\",\n \"en\"\n ],\n \"payload\": {\n \"onboarding_url\": \"https://app.maihuego.com/onboarding/abc\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"language": "es",
"content": {},
"errors": {}
}
],
"message": "<string>",
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}Template versions
Preview Template Version
Requires notification-template:find-one. Renders the version in
every language it has (or only locales) with a sample payload
generated from the event payload schema, merged with payload.
draft renders unsaved halves instead of the stored ones. Answers
one { language, content, errors } per language; a language that
does not render has empty content and its errors by field. The
body may be empty.
POST
/
notification
/
template
/
{document_id}
/
version
/
{version}
/
preview
Preview a template version
curl --request POST \
--url https://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"locales": [
"es",
"en"
],
"payload": {
"onboarding_url": "https://app.maihuego.com/onboarding/abc"
}
}
'import requests
url = "https://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview"
payload = {
"locales": ["es", "en"],
"payload": { "onboarding_url": "https://app.maihuego.com/onboarding/abc" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
locales: ['es', 'en'],
payload: {onboarding_url: 'https://app.maihuego.com/onboarding/abc'}
})
};
fetch('https://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview', 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://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'locales' => [
'es',
'en'
],
'payload' => [
'onboarding_url' => 'https://app.maihuego.com/onboarding/abc'
]
]),
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://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview"
payload := strings.NewReader("{\n \"locales\": [\n \"es\",\n \"en\"\n ],\n \"payload\": {\n \"onboarding_url\": \"https://app.maihuego.com/onboarding/abc\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"locales\": [\n \"es\",\n \"en\"\n ],\n \"payload\": {\n \"onboarding_url\": \"https://app.maihuego.com/onboarding/abc\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bbrands.io/api/v3/notification/template/{document_id}/version/{version}/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"locales\": [\n \"es\",\n \"en\"\n ],\n \"payload\": {\n \"onboarding_url\": \"https://app.maihuego.com/onboarding/abc\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"language": "es",
"content": {},
"errors": {}
}
],
"message": "<string>",
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}{
"error": {
"code": "<string>",
"errors": [
"<unknown>"
],
"message": "<string>"
},
"meta": {
"correlation": "<string>",
"status": 123,
"timestamp": "2023-11-07T05:31:56Z",
"version": "<string>"
}
}Authorizations
bearerAuthapiKeyAuth
Path Parameters
Body
application/json
Was this page helpful?