Models
Create campaign model
Registers a new WhatsApp campaign message template for the tenant on the given channel/provider, then submits it for provider approval. The template name is validated against provider-specific rules before being reserved.
POST
/
v1
/
tenants
/
{tenantID}
/
campaigns-models
Create campaign model
curl --request POST \
--url https://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"campaignModelChannel": "<string>",
"campaignModelChannelID": "<string>",
"campaignModelName": "<string>",
"campaignModelType": "<string>",
"campaignModelDescription": "<string>",
"campaignModelGatewayMeta": {},
"campaignModelMeta": {},
"campaignModelSlots": {
"body": {},
"buttons": [],
"footer": {},
"header": {}
},
"campaignModelTags": []
}
'import requests
url = "https://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models"
payload = {
"campaignModelChannel": "<string>",
"campaignModelChannelID": "<string>",
"campaignModelName": "<string>",
"campaignModelType": "<string>",
"campaignModelDescription": "<string>",
"campaignModelGatewayMeta": {},
"campaignModelMeta": {},
"campaignModelSlots": {
"body": {},
"buttons": [],
"footer": {},
"header": {}
},
"campaignModelTags": []
}
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({
campaignModelChannel: '<string>',
campaignModelChannelID: '<string>',
campaignModelName: '<string>',
campaignModelType: '<string>',
campaignModelDescription: '<string>',
campaignModelGatewayMeta: {},
campaignModelMeta: {},
campaignModelSlots: {body: JSON.stringify({}), buttons: [], footer: {}, header: {}},
campaignModelTags: []
})
};
fetch('https://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models', 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://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models",
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([
'campaignModelChannel' => '<string>',
'campaignModelChannelID' => '<string>',
'campaignModelName' => '<string>',
'campaignModelType' => '<string>',
'campaignModelDescription' => '<string>',
'campaignModelGatewayMeta' => [
],
'campaignModelMeta' => [
],
'campaignModelSlots' => [
'body' => [
],
'buttons' => [
],
'footer' => [
],
'header' => [
]
],
'campaignModelTags' => [
]
]),
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://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models"
payload := strings.NewReader("{\n \"campaignModelChannel\": \"<string>\",\n \"campaignModelChannelID\": \"<string>\",\n \"campaignModelName\": \"<string>\",\n \"campaignModelType\": \"<string>\",\n \"campaignModelDescription\": \"<string>\",\n \"campaignModelGatewayMeta\": {},\n \"campaignModelMeta\": {},\n \"campaignModelSlots\": {\n \"body\": {},\n \"buttons\": [],\n \"footer\": {},\n \"header\": {}\n },\n \"campaignModelTags\": []\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://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"campaignModelChannel\": \"<string>\",\n \"campaignModelChannelID\": \"<string>\",\n \"campaignModelName\": \"<string>\",\n \"campaignModelType\": \"<string>\",\n \"campaignModelDescription\": \"<string>\",\n \"campaignModelGatewayMeta\": {},\n \"campaignModelMeta\": {},\n \"campaignModelSlots\": {\n \"body\": {},\n \"buttons\": [],\n \"footer\": {},\n \"header\": {}\n },\n \"campaignModelTags\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models")
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 \"campaignModelChannel\": \"<string>\",\n \"campaignModelChannelID\": \"<string>\",\n \"campaignModelName\": \"<string>\",\n \"campaignModelType\": \"<string>\",\n \"campaignModelDescription\": \"<string>\",\n \"campaignModelGatewayMeta\": {},\n \"campaignModelMeta\": {},\n \"campaignModelSlots\": {\n \"body\": {},\n \"buttons\": [],\n \"footer\": {},\n \"header\": {}\n },\n \"campaignModelTags\": []\n}"
response = http.request(request)
puts response.read_body{
"campaignModel": {
"approvedAt": "2023-11-07T05:31:56Z",
"campaignModelChannel": "<string>",
"campaignModelChannelID": "<string>",
"campaignModelExternalID": "<string>",
"campaignModelGatewayMeta": {},
"campaignModelGatewayRaw": {},
"campaignModelID": "<string>",
"campaignModelMeta": {},
"campaignModelName": "<string>",
"campaignModelSlots": {
"body": {
"content": "<string>",
"text": "<string>",
"variables": [
{
"id": "<string>",
"key": "<string>",
"type": "<string>",
"fallback": "<string>"
}
]
},
"buttons": [
{
"text": "<string>",
"type": "ORDER_DETAILS",
"example": "<string>",
"otpType": "COPY_CODE",
"phoneNumber": "<string>",
"ttlMinutes": 123,
"url": "<string>"
}
],
"footer": {
"text": "<string>"
},
"header": {
"content": {},
"preview": "<string>",
"text": "<string>",
"variables": [
{
"id": "<string>",
"key": "<string>",
"type": "<string>",
"fallback": "<string>"
}
],
"type": "text"
}
},
"campaignModelStatus": "<string>",
"campaignModelTags": [
"<string>"
],
"campaignModelType": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"evaluatingAt": "2023-11-07T05:31:56Z",
"processingAt": "2023-11-07T05:31:56Z",
"refusedAt": "2023-11-07T05:31:56Z",
"tenantID": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"updatedBy": "<string>",
"__campaignModelErrorCode": 123,
"__campaignModelErrorMessage": "<string>",
"campaignModelDescription": "<string>",
"deletedAt": "2023-11-07T05:31:56Z",
"modelVariables": [
{
"key": "<string>",
"fallback": "<string>",
"required": true,
"type": "<string>"
}
]
}
}{
"errors": [
{
"error": "MissingTenantIDError",
"error_code": 1001,
"message": "tenantID is required.",
"statusCode": 400
}
]
}{
"errors": [
{
"error": "UnauthorizedError",
"error_code": 1003,
"message": "You are not authorized to perform this request.",
"statusCode": 401
}
]
}{
"errors": [
{
"error": "ForbiddenError",
"error_code": 1004,
"message": "You do not have access to this resource.",
"statusCode": 403
}
]
}{
"errors": [
{
"error": "CampaignModelNameUnavailableError",
"error_code": 1066,
"message": "Could not derive an available campaignModelName for this channel.",
"statusCode": 409
}
]
}{
"errors": [
{
"error": "UnknownError",
"error_code": 5999,
"message": "For some unknown reason your request has not succeeded.",
"statusCode": 500
}
]
}Authorizations
operatorAuthpluginConnectionAuth
Body
application/json
⌘I
Create campaign model
curl --request POST \
--url https://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"campaignModelChannel": "<string>",
"campaignModelChannelID": "<string>",
"campaignModelName": "<string>",
"campaignModelType": "<string>",
"campaignModelDescription": "<string>",
"campaignModelGatewayMeta": {},
"campaignModelMeta": {},
"campaignModelSlots": {
"body": {},
"buttons": [],
"footer": {},
"header": {}
},
"campaignModelTags": []
}
'import requests
url = "https://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models"
payload = {
"campaignModelChannel": "<string>",
"campaignModelChannelID": "<string>",
"campaignModelName": "<string>",
"campaignModelType": "<string>",
"campaignModelDescription": "<string>",
"campaignModelGatewayMeta": {},
"campaignModelMeta": {},
"campaignModelSlots": {
"body": {},
"buttons": [],
"footer": {},
"header": {}
},
"campaignModelTags": []
}
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({
campaignModelChannel: '<string>',
campaignModelChannelID: '<string>',
campaignModelName: '<string>',
campaignModelType: '<string>',
campaignModelDescription: '<string>',
campaignModelGatewayMeta: {},
campaignModelMeta: {},
campaignModelSlots: {body: JSON.stringify({}), buttons: [], footer: {}, header: {}},
campaignModelTags: []
})
};
fetch('https://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models', 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://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models",
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([
'campaignModelChannel' => '<string>',
'campaignModelChannelID' => '<string>',
'campaignModelName' => '<string>',
'campaignModelType' => '<string>',
'campaignModelDescription' => '<string>',
'campaignModelGatewayMeta' => [
],
'campaignModelMeta' => [
],
'campaignModelSlots' => [
'body' => [
],
'buttons' => [
],
'footer' => [
],
'header' => [
]
],
'campaignModelTags' => [
]
]),
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://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models"
payload := strings.NewReader("{\n \"campaignModelChannel\": \"<string>\",\n \"campaignModelChannelID\": \"<string>\",\n \"campaignModelName\": \"<string>\",\n \"campaignModelType\": \"<string>\",\n \"campaignModelDescription\": \"<string>\",\n \"campaignModelGatewayMeta\": {},\n \"campaignModelMeta\": {},\n \"campaignModelSlots\": {\n \"body\": {},\n \"buttons\": [],\n \"footer\": {},\n \"header\": {}\n },\n \"campaignModelTags\": []\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://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"campaignModelChannel\": \"<string>\",\n \"campaignModelChannelID\": \"<string>\",\n \"campaignModelName\": \"<string>\",\n \"campaignModelType\": \"<string>\",\n \"campaignModelDescription\": \"<string>\",\n \"campaignModelGatewayMeta\": {},\n \"campaignModelMeta\": {},\n \"campaignModelSlots\": {\n \"body\": {},\n \"buttons\": [],\n \"footer\": {},\n \"header\": {}\n },\n \"campaignModelTags\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services-api.talqui.chat/v1/tenants/{tenantID}/campaigns-models")
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 \"campaignModelChannel\": \"<string>\",\n \"campaignModelChannelID\": \"<string>\",\n \"campaignModelName\": \"<string>\",\n \"campaignModelType\": \"<string>\",\n \"campaignModelDescription\": \"<string>\",\n \"campaignModelGatewayMeta\": {},\n \"campaignModelMeta\": {},\n \"campaignModelSlots\": {\n \"body\": {},\n \"buttons\": [],\n \"footer\": {},\n \"header\": {}\n },\n \"campaignModelTags\": []\n}"
response = http.request(request)
puts response.read_body{
"campaignModel": {
"approvedAt": "2023-11-07T05:31:56Z",
"campaignModelChannel": "<string>",
"campaignModelChannelID": "<string>",
"campaignModelExternalID": "<string>",
"campaignModelGatewayMeta": {},
"campaignModelGatewayRaw": {},
"campaignModelID": "<string>",
"campaignModelMeta": {},
"campaignModelName": "<string>",
"campaignModelSlots": {
"body": {
"content": "<string>",
"text": "<string>",
"variables": [
{
"id": "<string>",
"key": "<string>",
"type": "<string>",
"fallback": "<string>"
}
]
},
"buttons": [
{
"text": "<string>",
"type": "ORDER_DETAILS",
"example": "<string>",
"otpType": "COPY_CODE",
"phoneNumber": "<string>",
"ttlMinutes": 123,
"url": "<string>"
}
],
"footer": {
"text": "<string>"
},
"header": {
"content": {},
"preview": "<string>",
"text": "<string>",
"variables": [
{
"id": "<string>",
"key": "<string>",
"type": "<string>",
"fallback": "<string>"
}
],
"type": "text"
}
},
"campaignModelStatus": "<string>",
"campaignModelTags": [
"<string>"
],
"campaignModelType": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"evaluatingAt": "2023-11-07T05:31:56Z",
"processingAt": "2023-11-07T05:31:56Z",
"refusedAt": "2023-11-07T05:31:56Z",
"tenantID": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"updatedBy": "<string>",
"__campaignModelErrorCode": 123,
"__campaignModelErrorMessage": "<string>",
"campaignModelDescription": "<string>",
"deletedAt": "2023-11-07T05:31:56Z",
"modelVariables": [
{
"key": "<string>",
"fallback": "<string>",
"required": true,
"type": "<string>"
}
]
}
}{
"errors": [
{
"error": "MissingTenantIDError",
"error_code": 1001,
"message": "tenantID is required.",
"statusCode": 400
}
]
}{
"errors": [
{
"error": "UnauthorizedError",
"error_code": 1003,
"message": "You are not authorized to perform this request.",
"statusCode": 401
}
]
}{
"errors": [
{
"error": "ForbiddenError",
"error_code": 1004,
"message": "You do not have access to this resource.",
"statusCode": 403
}
]
}{
"errors": [
{
"error": "CampaignModelNameUnavailableError",
"error_code": 1066,
"message": "Could not derive an available campaignModelName for this channel.",
"statusCode": 409
}
]
}{
"errors": [
{
"error": "UnknownError",
"error_code": 5999,
"message": "For some unknown reason your request has not succeeded.",
"statusCode": 500
}
]
}