Create Templates
curl --request POST \
--url https://api.bleeprs.com/api/createTemplates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"body": "My name is {{1}} and i am from {{2}}",
"indexes": [
"1",
"2"
],
"name": "Welcome Message",
"slug": "WLG",
"useCase": "business"
}
'import requests
url = "https://api.bleeprs.com/api/createTemplates"
payload = {
"body": "My name is {{1}} and i am from {{2}}",
"indexes": ["1", "2"],
"name": "Welcome Message",
"slug": "WLG",
"useCase": "business"
}
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({
body: JSON.stringify('My name is {{1}} and i am from {{2}}'),
indexes: ['1', '2'],
name: 'Welcome Message',
slug: 'WLG',
useCase: 'business'
})
};
fetch('https://api.bleeprs.com/api/createTemplates', 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.bleeprs.com/api/createTemplates",
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([
'body' => 'My name is {{1}} and i am from {{2}}',
'indexes' => [
'1',
'2'
],
'name' => 'Welcome Message',
'slug' => 'WLG',
'useCase' => 'business'
]),
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.bleeprs.com/api/createTemplates"
payload := strings.NewReader("{\n \"body\": \"My name is {{1}} and i am from {{2}}\",\n \"indexes\": [\n \"1\",\n \"2\"\n ],\n \"name\": \"Welcome Message\",\n \"slug\": \"WLG\",\n \"useCase\": \"business\"\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.bleeprs.com/api/createTemplates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"body\": \"My name is {{1}} and i am from {{2}}\",\n \"indexes\": [\n \"1\",\n \"2\"\n ],\n \"name\": \"Welcome Message\",\n \"slug\": \"WLG\",\n \"useCase\": \"business\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bleeprs.com/api/createTemplates")
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 \"body\": \"My name is {{1}} and i am from {{2}}\",\n \"indexes\": [\n \"1\",\n \"2\"\n ],\n \"name\": \"Welcome Message\",\n \"slug\": \"WLG\",\n \"useCase\": \"business\"\n}"
response = http.request(request)
puts response.read_bodyTemplate
Create Templates
Create a dynamic message template
POST
/
createTemplates
Create Templates
curl --request POST \
--url https://api.bleeprs.com/api/createTemplates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"body": "My name is {{1}} and i am from {{2}}",
"indexes": [
"1",
"2"
],
"name": "Welcome Message",
"slug": "WLG",
"useCase": "business"
}
'import requests
url = "https://api.bleeprs.com/api/createTemplates"
payload = {
"body": "My name is {{1}} and i am from {{2}}",
"indexes": ["1", "2"],
"name": "Welcome Message",
"slug": "WLG",
"useCase": "business"
}
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({
body: JSON.stringify('My name is {{1}} and i am from {{2}}'),
indexes: ['1', '2'],
name: 'Welcome Message',
slug: 'WLG',
useCase: 'business'
})
};
fetch('https://api.bleeprs.com/api/createTemplates', 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.bleeprs.com/api/createTemplates",
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([
'body' => 'My name is {{1}} and i am from {{2}}',
'indexes' => [
'1',
'2'
],
'name' => 'Welcome Message',
'slug' => 'WLG',
'useCase' => 'business'
]),
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.bleeprs.com/api/createTemplates"
payload := strings.NewReader("{\n \"body\": \"My name is {{1}} and i am from {{2}}\",\n \"indexes\": [\n \"1\",\n \"2\"\n ],\n \"name\": \"Welcome Message\",\n \"slug\": \"WLG\",\n \"useCase\": \"business\"\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.bleeprs.com/api/createTemplates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"body\": \"My name is {{1}} and i am from {{2}}\",\n \"indexes\": [\n \"1\",\n \"2\"\n ],\n \"name\": \"Welcome Message\",\n \"slug\": \"WLG\",\n \"useCase\": \"business\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bleeprs.com/api/createTemplates")
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 \"body\": \"My name is {{1}} and i am from {{2}}\",\n \"indexes\": [\n \"1\",\n \"2\"\n ],\n \"name\": \"Welcome Message\",\n \"slug\": \"WLG\",\n \"useCase\": \"business\"\n}"
response = http.request(request)
puts response.read_bodyVariables can be used on all templates built with Content Template Builder. There are a few differing rules for variables sent in a user and business initiated sessions.
Some Template Rules
Content variables need to be in sequential order. They can be is non-sequential order within a template, but variable definitions should not skip over integers. Not Allowed:body: Hi {{1}}, Your flight will depart from gate {{3}}. Please reply Stop to unsubscribe.
Allowed: body: Hi {{1}}, Your flight will depart from gate {{2}}. Please reply Stop to unsubscribe.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
The standard body with possible interpolated fields
Example:
"My name is {{1}} and i am from {{2}}"
The integers in a format of a string in {{1}} from body
Example:
["1", "2"]
Template name
Example:
"Welcome Message"
Template slug
Example:
"WLG"
Template Use cases seprated by comma
Example:
"business"
Response
200 - undefined
Was this page helpful?
⌘I