Crea una campaña
curl --request POST \
--url https://api-v2.sofiachat.com/api/v1/campaigns \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Promo julio clientes VIP",
"integrationId": 12,
"templateId": 87,
"conversationTagId": 4,
"parameterMapping": {
"body": [
{
"source": "contact_field",
"field": "first_name"
}
]
},
"scheduledAt": "2026-08-30T15:00:00Z",
"groupIds": [
1,
2
],
"contactIds": [
345,
346
]
}
'import requests
url = "https://api-v2.sofiachat.com/api/v1/campaigns"
payload = {
"name": "Promo julio clientes VIP",
"integrationId": 12,
"templateId": 87,
"conversationTagId": 4,
"parameterMapping": { "body": [
{
"source": "contact_field",
"field": "first_name"
}
] },
"scheduledAt": "2026-08-30T15:00:00Z",
"groupIds": [1, 2],
"contactIds": [345, 346]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Promo julio clientes VIP',
integrationId: 12,
templateId: 87,
conversationTagId: 4,
parameterMapping: {body: JSON.stringify([{source: 'contact_field', field: 'first_name'}])},
scheduledAt: '2026-08-30T15:00:00Z',
groupIds: [1, 2],
contactIds: [345, 346]
})
};
fetch('https://api-v2.sofiachat.com/api/v1/campaigns', 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-v2.sofiachat.com/api/v1/campaigns",
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([
'name' => 'Promo julio clientes VIP',
'integrationId' => 12,
'templateId' => 87,
'conversationTagId' => 4,
'parameterMapping' => [
'body' => [
[
'source' => 'contact_field',
'field' => 'first_name'
]
]
],
'scheduledAt' => '2026-08-30T15:00:00Z',
'groupIds' => [
1,
2
],
'contactIds' => [
345,
346
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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-v2.sofiachat.com/api/v1/campaigns"
payload := strings.NewReader("{\n \"name\": \"Promo julio clientes VIP\",\n \"integrationId\": 12,\n \"templateId\": 87,\n \"conversationTagId\": 4,\n \"parameterMapping\": {\n \"body\": [\n {\n \"source\": \"contact_field\",\n \"field\": \"first_name\"\n }\n ]\n },\n \"scheduledAt\": \"2026-08-30T15:00:00Z\",\n \"groupIds\": [\n 1,\n 2\n ],\n \"contactIds\": [\n 345,\n 346\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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-v2.sofiachat.com/api/v1/campaigns")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Promo julio clientes VIP\",\n \"integrationId\": 12,\n \"templateId\": 87,\n \"conversationTagId\": 4,\n \"parameterMapping\": {\n \"body\": [\n {\n \"source\": \"contact_field\",\n \"field\": \"first_name\"\n }\n ]\n },\n \"scheduledAt\": \"2026-08-30T15:00:00Z\",\n \"groupIds\": [\n 1,\n 2\n ],\n \"contactIds\": [\n 345,\n 346\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v2.sofiachat.com/api/v1/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Promo julio clientes VIP\",\n \"integrationId\": 12,\n \"templateId\": 87,\n \"conversationTagId\": 4,\n \"parameterMapping\": {\n \"body\": [\n {\n \"source\": \"contact_field\",\n \"field\": \"first_name\"\n }\n ]\n },\n \"scheduledAt\": \"2026-08-30T15:00:00Z\",\n \"groupIds\": [\n 1,\n 2\n ],\n \"contactIds\": [\n 345,\n 346\n ]\n}"
response = http.request(request)
puts response.read_bodyCampañas
Crea una campaña
POST
/
campaigns
Crea una campaña
curl --request POST \
--url https://api-v2.sofiachat.com/api/v1/campaigns \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Promo julio clientes VIP",
"integrationId": 12,
"templateId": 87,
"conversationTagId": 4,
"parameterMapping": {
"body": [
{
"source": "contact_field",
"field": "first_name"
}
]
},
"scheduledAt": "2026-08-30T15:00:00Z",
"groupIds": [
1,
2
],
"contactIds": [
345,
346
]
}
'import requests
url = "https://api-v2.sofiachat.com/api/v1/campaigns"
payload = {
"name": "Promo julio clientes VIP",
"integrationId": 12,
"templateId": 87,
"conversationTagId": 4,
"parameterMapping": { "body": [
{
"source": "contact_field",
"field": "first_name"
}
] },
"scheduledAt": "2026-08-30T15:00:00Z",
"groupIds": [1, 2],
"contactIds": [345, 346]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Promo julio clientes VIP',
integrationId: 12,
templateId: 87,
conversationTagId: 4,
parameterMapping: {body: JSON.stringify([{source: 'contact_field', field: 'first_name'}])},
scheduledAt: '2026-08-30T15:00:00Z',
groupIds: [1, 2],
contactIds: [345, 346]
})
};
fetch('https://api-v2.sofiachat.com/api/v1/campaigns', 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-v2.sofiachat.com/api/v1/campaigns",
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([
'name' => 'Promo julio clientes VIP',
'integrationId' => 12,
'templateId' => 87,
'conversationTagId' => 4,
'parameterMapping' => [
'body' => [
[
'source' => 'contact_field',
'field' => 'first_name'
]
]
],
'scheduledAt' => '2026-08-30T15:00:00Z',
'groupIds' => [
1,
2
],
'contactIds' => [
345,
346
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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-v2.sofiachat.com/api/v1/campaigns"
payload := strings.NewReader("{\n \"name\": \"Promo julio clientes VIP\",\n \"integrationId\": 12,\n \"templateId\": 87,\n \"conversationTagId\": 4,\n \"parameterMapping\": {\n \"body\": [\n {\n \"source\": \"contact_field\",\n \"field\": \"first_name\"\n }\n ]\n },\n \"scheduledAt\": \"2026-08-30T15:00:00Z\",\n \"groupIds\": [\n 1,\n 2\n ],\n \"contactIds\": [\n 345,\n 346\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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-v2.sofiachat.com/api/v1/campaigns")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Promo julio clientes VIP\",\n \"integrationId\": 12,\n \"templateId\": 87,\n \"conversationTagId\": 4,\n \"parameterMapping\": {\n \"body\": [\n {\n \"source\": \"contact_field\",\n \"field\": \"first_name\"\n }\n ]\n },\n \"scheduledAt\": \"2026-08-30T15:00:00Z\",\n \"groupIds\": [\n 1,\n 2\n ],\n \"contactIds\": [\n 345,\n 346\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-v2.sofiachat.com/api/v1/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Promo julio clientes VIP\",\n \"integrationId\": 12,\n \"templateId\": 87,\n \"conversationTagId\": 4,\n \"parameterMapping\": {\n \"body\": [\n {\n \"source\": \"contact_field\",\n \"field\": \"first_name\"\n }\n ]\n },\n \"scheduledAt\": \"2026-08-30T15:00:00Z\",\n \"groupIds\": [\n 1,\n 2\n ],\n \"contactIds\": [\n 345,\n 346\n ]\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Body
application/json
Nombre de la campaña
Example:
"Promo julio clientes VIP"
Integración de WhatsApp desde la que se envía
Example:
12
Plantilla aprobada por Meta que se enviará
Example:
87
Tag que se estampa en cada conversación generada (los agentes filtran por tag)
Example:
4
ParameterMapping que consume TemplateMessageBuilder
Example:
{
"body": [
{
"source": "contact_field",
"field": "first_name"
}
]
}
Fecha/hora de envío programado en UTC (ISO 8601). Sin ella la campaña queda en draft
Example:
"2026-08-30T15:00:00Z"
Grupos de contactos destinatarios
Example:
[1, 2]
Contactos destinatarios individuales
Example:
[345, 346]
Response
201 - undefined

