curl --request POST \
--url https://api-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data @- <<EOF
{
"contact": {
"identifier": "+573001234567",
"identifierType": "PHONE",
"messageProviderType": "WHATSAPP",
"providerChannelId": "c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c"
},
"template": {
"id": "7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f",
"name": "leadscout_outbound_fb_v1",
"orderedParams": [
"Maria",
"ACME"
],
"parameters": {
"recipient_first_name": "Maria",
"tracking_code": "TRK123"
},
"media": {
"type": "IMAGE",
"mediaId": null,
"url": null
}
},
"additionalMessages": [
{
"messageBody": "Just confirming we're still on for tomorrow at 10am.",
"mediaIds": []
}
],
"agentContext": {
"notes": "The Contact asked about pricing tiers last week.",
"mediaIds": []
},
"consent": {
"status": "GRANTED",
"capturedAt": "2026-04-20T10:00:00.000Z"
},
"handoffOverride": {
"preAssignedUser": {
"identifier": "advisor@acme.com",
"identifierType": "EMAIL"
}
},
"brandId": null,
"campaignId": null,
"forceSend": false
}
EOFimport requests
url = "https://api-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound"
payload = {
"contact": {
"identifier": "+573001234567",
"identifierType": "PHONE",
"messageProviderType": "WHATSAPP",
"providerChannelId": "c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c"
},
"template": {
"id": "7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f",
"name": "leadscout_outbound_fb_v1",
"orderedParams": ["Maria", "ACME"],
"parameters": {
"recipient_first_name": "Maria",
"tracking_code": "TRK123"
},
"media": {
"type": "IMAGE",
"mediaId": None,
"url": None
}
},
"additionalMessages": [
{
"messageBody": "Just confirming we're still on for tomorrow at 10am.",
"mediaIds": []
}
],
"agentContext": {
"notes": "The Contact asked about pricing tiers last week.",
"mediaIds": []
},
"consent": {
"status": "GRANTED",
"capturedAt": "2026-04-20T10:00:00.000Z"
},
"handoffOverride": { "preAssignedUser": {
"identifier": "advisor@acme.com",
"identifierType": "EMAIL"
} },
"brandId": None,
"campaignId": None,
"forceSend": False
}
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({
contact: {
identifier: '+573001234567',
identifierType: 'PHONE',
messageProviderType: 'WHATSAPP',
providerChannelId: 'c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c'
},
template: {
id: '7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f',
name: 'leadscout_outbound_fb_v1',
orderedParams: ['Maria', 'ACME'],
parameters: {recipient_first_name: 'Maria', tracking_code: 'TRK123'},
media: {type: 'IMAGE', mediaId: null, url: null}
},
additionalMessages: [
{
messageBody: 'Just confirming we\'re still on for tomorrow at 10am.',
mediaIds: []
}
],
agentContext: {notes: 'The Contact asked about pricing tiers last week.', mediaIds: []},
consent: {status: 'GRANTED', capturedAt: '2026-04-20T10:00:00.000Z'},
handoffOverride: {preAssignedUser: {identifier: 'advisor@acme.com', identifierType: 'EMAIL'}},
brandId: null,
campaignId: null,
forceSend: false
})
};
fetch('https://api-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound', 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-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound",
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([
'contact' => [
'identifier' => '+573001234567',
'identifierType' => 'PHONE',
'messageProviderType' => 'WHATSAPP',
'providerChannelId' => 'c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c'
],
'template' => [
'id' => '7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f',
'name' => 'leadscout_outbound_fb_v1',
'orderedParams' => [
'Maria',
'ACME'
],
'parameters' => [
'recipient_first_name' => 'Maria',
'tracking_code' => 'TRK123'
],
'media' => [
'type' => 'IMAGE',
'mediaId' => null,
'url' => null
]
],
'additionalMessages' => [
[
'messageBody' => 'Just confirming we\'re still on for tomorrow at 10am.',
'mediaIds' => [
]
]
],
'agentContext' => [
'notes' => 'The Contact asked about pricing tiers last week.',
'mediaIds' => [
]
],
'consent' => [
'status' => 'GRANTED',
'capturedAt' => '2026-04-20T10:00:00.000Z'
],
'handoffOverride' => [
'preAssignedUser' => [
'identifier' => 'advisor@acme.com',
'identifierType' => 'EMAIL'
]
],
'brandId' => null,
'campaignId' => null,
'forceSend' => false
]),
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-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound"
payload := strings.NewReader("{\n \"contact\": {\n \"identifier\": \"+573001234567\",\n \"identifierType\": \"PHONE\",\n \"messageProviderType\": \"WHATSAPP\",\n \"providerChannelId\": \"c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c\"\n },\n \"template\": {\n \"id\": \"7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f\",\n \"name\": \"leadscout_outbound_fb_v1\",\n \"orderedParams\": [\n \"Maria\",\n \"ACME\"\n ],\n \"parameters\": {\n \"recipient_first_name\": \"Maria\",\n \"tracking_code\": \"TRK123\"\n },\n \"media\": {\n \"type\": \"IMAGE\",\n \"mediaId\": null,\n \"url\": null\n }\n },\n \"additionalMessages\": [\n {\n \"messageBody\": \"Just confirming we're still on for tomorrow at 10am.\",\n \"mediaIds\": []\n }\n ],\n \"agentContext\": {\n \"notes\": \"The Contact asked about pricing tiers last week.\",\n \"mediaIds\": []\n },\n \"consent\": {\n \"status\": \"GRANTED\",\n \"capturedAt\": \"2026-04-20T10:00:00.000Z\"\n },\n \"handoffOverride\": {\n \"preAssignedUser\": {\n \"identifier\": \"advisor@acme.com\",\n \"identifierType\": \"EMAIL\"\n }\n },\n \"brandId\": null,\n \"campaignId\": null,\n \"forceSend\": false\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-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"contact\": {\n \"identifier\": \"+573001234567\",\n \"identifierType\": \"PHONE\",\n \"messageProviderType\": \"WHATSAPP\",\n \"providerChannelId\": \"c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c\"\n },\n \"template\": {\n \"id\": \"7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f\",\n \"name\": \"leadscout_outbound_fb_v1\",\n \"orderedParams\": [\n \"Maria\",\n \"ACME\"\n ],\n \"parameters\": {\n \"recipient_first_name\": \"Maria\",\n \"tracking_code\": \"TRK123\"\n },\n \"media\": {\n \"type\": \"IMAGE\",\n \"mediaId\": null,\n \"url\": null\n }\n },\n \"additionalMessages\": [\n {\n \"messageBody\": \"Just confirming we're still on for tomorrow at 10am.\",\n \"mediaIds\": []\n }\n ],\n \"agentContext\": {\n \"notes\": \"The Contact asked about pricing tiers last week.\",\n \"mediaIds\": []\n },\n \"consent\": {\n \"status\": \"GRANTED\",\n \"capturedAt\": \"2026-04-20T10:00:00.000Z\"\n },\n \"handoffOverride\": {\n \"preAssignedUser\": {\n \"identifier\": \"advisor@acme.com\",\n \"identifierType\": \"EMAIL\"\n }\n },\n \"brandId\": null,\n \"campaignId\": null,\n \"forceSend\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound")
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 \"contact\": {\n \"identifier\": \"+573001234567\",\n \"identifierType\": \"PHONE\",\n \"messageProviderType\": \"WHATSAPP\",\n \"providerChannelId\": \"c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c\"\n },\n \"template\": {\n \"id\": \"7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f\",\n \"name\": \"leadscout_outbound_fb_v1\",\n \"orderedParams\": [\n \"Maria\",\n \"ACME\"\n ],\n \"parameters\": {\n \"recipient_first_name\": \"Maria\",\n \"tracking_code\": \"TRK123\"\n },\n \"media\": {\n \"type\": \"IMAGE\",\n \"mediaId\": null,\n \"url\": null\n }\n },\n \"additionalMessages\": [\n {\n \"messageBody\": \"Just confirming we're still on for tomorrow at 10am.\",\n \"mediaIds\": []\n }\n ],\n \"agentContext\": {\n \"notes\": \"The Contact asked about pricing tiers last week.\",\n \"mediaIds\": []\n },\n \"consent\": {\n \"status\": \"GRANTED\",\n \"capturedAt\": \"2026-04-20T10:00:00.000Z\"\n },\n \"handoffOverride\": {\n \"preAssignedUser\": {\n \"identifier\": \"advisor@acme.com\",\n \"identifierType\": \"EMAIL\"\n }\n },\n \"brandId\": null,\n \"campaignId\": null,\n \"forceSend\": false\n}"
response = http.request(request)
puts response.read_body{
"conversation": {
"id": "b6cf1c4a-2b1e-4e63-8f3e-0f9d1a2a1234",
"workspaceId": "b6cf1c4a-2b1e-4e63-8f3e-0f9d1a2a1234",
"participants": {
"externals": [
{
"identifier": "ef7ee722-5f95-415a-9a98-81eeae178b11",
"identifierType": "EMAIL",
"role": "EXTERNAL",
"joinedAt": "2004-04-10T09:00:00.000Z",
"lastSeenAt": null
}
],
"internals": [
{
"identifier": "ef7ee722-5f95-415a-9a98-81eeae178b11",
"identifierType": "EMAIL",
"role": "EXTERNAL",
"joinedAt": "2004-04-10T09:00:00.000Z",
"lastSeenAt": null
}
]
},
"createdAt": "2003-04-10T09:00:00.000Z",
"updatedAt": "2003-04-10T09:00:00.000Z",
"name": "Bridge Support Team",
"status": "ACTIVE"
},
"contact": {
"id": "b6cf1c4a-2b1e-4e63-8f3e-0f9d1a2a1234",
"workspaceId": "92b2d4f3-81e1-4b61-a7ec-6f4ff3b58be5",
"type": "NORMAL",
"createdAt": "2003-04-10T08:00:00.000Z",
"updatedAt": "2003-04-10T08:00:00.000Z",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"cellphone": "+14084029292",
"customAttributes": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"languageCode": "EN",
"ownerId": "37673840-6259-40f9-bbe5-a7db40f8e3cf"
},
"templateSent": {
"name": "leadscout_outbound_fb_v1",
"id": "7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f",
"messageId": "7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f"
},
"additionalMessagesPersisted": 0,
"alreadyInitiated": false,
"recovered": false
}Iniciar conversa de saída com um Contact como Agent específico
Inicia uma conversa de saída com um Contact conhecido, atendida pelo Agent indicado.
Funciona com Agents LeadScout e Service. Primeiro é resolvido o Contact e depois o Agent, que deve existir no workspace e estar disponível (consulte GET /agents). O template é referenciado por template.id ou template.name (id tem precedência quando ambos são enviados), deve existir e estar APPROVED, e qualquer Bridge User de handoffOverride deve ser válido. Se template.media.mediaId for desconhecido, a solicitação falha com 400 BRIDGE_AI_LEADSCOUT_0016 somente depois de a conversa ser criada ou recuperada, portanto uma nova tentativa após esse erro pode responder de forma diferente. As regras do corpo (consent.status=GRANTED sem capturedAt, ou template.media sem exatamente um de mediaId ou url) falham com 400 BRIDGE_CORE_0103.
A conversa é aberta em uma das linhas ativas de WhatsApp do Agent, sob seu controle, com o template como primeira mensagem. A linha é escolhida nesta ordem:
- Uma linha livre.
- Caso contrário, uma linha com uma conversa liberada recuperável com este Contact. A recuperação retorna
recovered=truee substitui o contexto de saída anterior eagentContext. Isso acontece mesmo comforceSend=false. - Se nenhuma linha estiver livre ou for recuperável:
forceSend=false(padrão) falha com 409BRIDGE_AI_LEADSCOUT_0008;forceSend=truereutiliza uma linha ocupada por uma conversa ativa com este Contact, dando preferência a uma controlada por este Agent. Se a conversa escolhida for controlada por outro Agent ou por um Bridge User, a chamada falha com 409BRIDGE_AI_AGENT_OUTBOUND_0006e nada é gravado. Libere-a primeiro e tente novamente. Linhas cuja conversa está bloqueada ou foi liberada sem recuperação nunca são usadas; assim, se nenhuma linha estiver ocupada por uma conversa ativa, a chamada falha com 409BRIDGE_AI_LEADSCOUT_0008mesmo comforceSend=true.
contact.providerChannelId é uma preferência: a linha indicada é usada quando está livre ou é recuperável; caso contrário, a mesma ordem é aplicada entre todas as linhas do Agent. Entre as linhas ocupadas, uma controlada por este Agent tem prioridade; se nenhuma for, a linha indicada é reutilizada (e pode falhar com 0006).
A reutilização de uma conversa depende do tipo de Agent:
- LeadScout: se sua sessão do LeadScout ainda estiver aberta e não expirada, a chamada falha com 409
BRIDGE_AI_LEADSCOUT_0017(extraincluiconversationId,sessionIdestage). Se uma sessão expirada não puder ser finalizada, falha com 409BRIDGE_AI_LEADSCOUT_0018. - Service Agent: uma sessão de serviço aberta e não expirada continua; uma sessão expirada é encerrada como abandonada e uma nova é aberta.
Consulte o guia completo de saída para os pré-requisitos, a tabela de decisão de forceSend, a recuperação, o trabalho parcial e as decisões seguras de nova tentativa.
curl --request POST \
--url https://api-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data @- <<EOF
{
"contact": {
"identifier": "+573001234567",
"identifierType": "PHONE",
"messageProviderType": "WHATSAPP",
"providerChannelId": "c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c"
},
"template": {
"id": "7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f",
"name": "leadscout_outbound_fb_v1",
"orderedParams": [
"Maria",
"ACME"
],
"parameters": {
"recipient_first_name": "Maria",
"tracking_code": "TRK123"
},
"media": {
"type": "IMAGE",
"mediaId": null,
"url": null
}
},
"additionalMessages": [
{
"messageBody": "Just confirming we're still on for tomorrow at 10am.",
"mediaIds": []
}
],
"agentContext": {
"notes": "The Contact asked about pricing tiers last week.",
"mediaIds": []
},
"consent": {
"status": "GRANTED",
"capturedAt": "2026-04-20T10:00:00.000Z"
},
"handoffOverride": {
"preAssignedUser": {
"identifier": "advisor@acme.com",
"identifierType": "EMAIL"
}
},
"brandId": null,
"campaignId": null,
"forceSend": false
}
EOFimport requests
url = "https://api-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound"
payload = {
"contact": {
"identifier": "+573001234567",
"identifierType": "PHONE",
"messageProviderType": "WHATSAPP",
"providerChannelId": "c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c"
},
"template": {
"id": "7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f",
"name": "leadscout_outbound_fb_v1",
"orderedParams": ["Maria", "ACME"],
"parameters": {
"recipient_first_name": "Maria",
"tracking_code": "TRK123"
},
"media": {
"type": "IMAGE",
"mediaId": None,
"url": None
}
},
"additionalMessages": [
{
"messageBody": "Just confirming we're still on for tomorrow at 10am.",
"mediaIds": []
}
],
"agentContext": {
"notes": "The Contact asked about pricing tiers last week.",
"mediaIds": []
},
"consent": {
"status": "GRANTED",
"capturedAt": "2026-04-20T10:00:00.000Z"
},
"handoffOverride": { "preAssignedUser": {
"identifier": "advisor@acme.com",
"identifierType": "EMAIL"
} },
"brandId": None,
"campaignId": None,
"forceSend": False
}
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({
contact: {
identifier: '+573001234567',
identifierType: 'PHONE',
messageProviderType: 'WHATSAPP',
providerChannelId: 'c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c'
},
template: {
id: '7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f',
name: 'leadscout_outbound_fb_v1',
orderedParams: ['Maria', 'ACME'],
parameters: {recipient_first_name: 'Maria', tracking_code: 'TRK123'},
media: {type: 'IMAGE', mediaId: null, url: null}
},
additionalMessages: [
{
messageBody: 'Just confirming we\'re still on for tomorrow at 10am.',
mediaIds: []
}
],
agentContext: {notes: 'The Contact asked about pricing tiers last week.', mediaIds: []},
consent: {status: 'GRANTED', capturedAt: '2026-04-20T10:00:00.000Z'},
handoffOverride: {preAssignedUser: {identifier: 'advisor@acme.com', identifierType: 'EMAIL'}},
brandId: null,
campaignId: null,
forceSend: false
})
};
fetch('https://api-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound', 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-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound",
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([
'contact' => [
'identifier' => '+573001234567',
'identifierType' => 'PHONE',
'messageProviderType' => 'WHATSAPP',
'providerChannelId' => 'c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c'
],
'template' => [
'id' => '7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f',
'name' => 'leadscout_outbound_fb_v1',
'orderedParams' => [
'Maria',
'ACME'
],
'parameters' => [
'recipient_first_name' => 'Maria',
'tracking_code' => 'TRK123'
],
'media' => [
'type' => 'IMAGE',
'mediaId' => null,
'url' => null
]
],
'additionalMessages' => [
[
'messageBody' => 'Just confirming we\'re still on for tomorrow at 10am.',
'mediaIds' => [
]
]
],
'agentContext' => [
'notes' => 'The Contact asked about pricing tiers last week.',
'mediaIds' => [
]
],
'consent' => [
'status' => 'GRANTED',
'capturedAt' => '2026-04-20T10:00:00.000Z'
],
'handoffOverride' => [
'preAssignedUser' => [
'identifier' => 'advisor@acme.com',
'identifierType' => 'EMAIL'
]
],
'brandId' => null,
'campaignId' => null,
'forceSend' => false
]),
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-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound"
payload := strings.NewReader("{\n \"contact\": {\n \"identifier\": \"+573001234567\",\n \"identifierType\": \"PHONE\",\n \"messageProviderType\": \"WHATSAPP\",\n \"providerChannelId\": \"c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c\"\n },\n \"template\": {\n \"id\": \"7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f\",\n \"name\": \"leadscout_outbound_fb_v1\",\n \"orderedParams\": [\n \"Maria\",\n \"ACME\"\n ],\n \"parameters\": {\n \"recipient_first_name\": \"Maria\",\n \"tracking_code\": \"TRK123\"\n },\n \"media\": {\n \"type\": \"IMAGE\",\n \"mediaId\": null,\n \"url\": null\n }\n },\n \"additionalMessages\": [\n {\n \"messageBody\": \"Just confirming we're still on for tomorrow at 10am.\",\n \"mediaIds\": []\n }\n ],\n \"agentContext\": {\n \"notes\": \"The Contact asked about pricing tiers last week.\",\n \"mediaIds\": []\n },\n \"consent\": {\n \"status\": \"GRANTED\",\n \"capturedAt\": \"2026-04-20T10:00:00.000Z\"\n },\n \"handoffOverride\": {\n \"preAssignedUser\": {\n \"identifier\": \"advisor@acme.com\",\n \"identifierType\": \"EMAIL\"\n }\n },\n \"brandId\": null,\n \"campaignId\": null,\n \"forceSend\": false\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-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"contact\": {\n \"identifier\": \"+573001234567\",\n \"identifierType\": \"PHONE\",\n \"messageProviderType\": \"WHATSAPP\",\n \"providerChannelId\": \"c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c\"\n },\n \"template\": {\n \"id\": \"7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f\",\n \"name\": \"leadscout_outbound_fb_v1\",\n \"orderedParams\": [\n \"Maria\",\n \"ACME\"\n ],\n \"parameters\": {\n \"recipient_first_name\": \"Maria\",\n \"tracking_code\": \"TRK123\"\n },\n \"media\": {\n \"type\": \"IMAGE\",\n \"mediaId\": null,\n \"url\": null\n }\n },\n \"additionalMessages\": [\n {\n \"messageBody\": \"Just confirming we're still on for tomorrow at 10am.\",\n \"mediaIds\": []\n }\n ],\n \"agentContext\": {\n \"notes\": \"The Contact asked about pricing tiers last week.\",\n \"mediaIds\": []\n },\n \"consent\": {\n \"status\": \"GRANTED\",\n \"capturedAt\": \"2026-04-20T10:00:00.000Z\"\n },\n \"handoffOverride\": {\n \"preAssignedUser\": {\n \"identifier\": \"advisor@acme.com\",\n \"identifierType\": \"EMAIL\"\n }\n },\n \"brandId\": null,\n \"campaignId\": null,\n \"forceSend\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-connect-us.bridge.new/bridge/api/v1/workspaces/{workspaceId}/agents/{agentId}/outbound")
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 \"contact\": {\n \"identifier\": \"+573001234567\",\n \"identifierType\": \"PHONE\",\n \"messageProviderType\": \"WHATSAPP\",\n \"providerChannelId\": \"c4f2a1e0-9b8d-4e7c-a6f5-1d2e3f4a5b6c\"\n },\n \"template\": {\n \"id\": \"7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f\",\n \"name\": \"leadscout_outbound_fb_v1\",\n \"orderedParams\": [\n \"Maria\",\n \"ACME\"\n ],\n \"parameters\": {\n \"recipient_first_name\": \"Maria\",\n \"tracking_code\": \"TRK123\"\n },\n \"media\": {\n \"type\": \"IMAGE\",\n \"mediaId\": null,\n \"url\": null\n }\n },\n \"additionalMessages\": [\n {\n \"messageBody\": \"Just confirming we're still on for tomorrow at 10am.\",\n \"mediaIds\": []\n }\n ],\n \"agentContext\": {\n \"notes\": \"The Contact asked about pricing tiers last week.\",\n \"mediaIds\": []\n },\n \"consent\": {\n \"status\": \"GRANTED\",\n \"capturedAt\": \"2026-04-20T10:00:00.000Z\"\n },\n \"handoffOverride\": {\n \"preAssignedUser\": {\n \"identifier\": \"advisor@acme.com\",\n \"identifierType\": \"EMAIL\"\n }\n },\n \"brandId\": null,\n \"campaignId\": null,\n \"forceSend\": false\n}"
response = http.request(request)
puts response.read_body{
"conversation": {
"id": "b6cf1c4a-2b1e-4e63-8f3e-0f9d1a2a1234",
"workspaceId": "b6cf1c4a-2b1e-4e63-8f3e-0f9d1a2a1234",
"participants": {
"externals": [
{
"identifier": "ef7ee722-5f95-415a-9a98-81eeae178b11",
"identifierType": "EMAIL",
"role": "EXTERNAL",
"joinedAt": "2004-04-10T09:00:00.000Z",
"lastSeenAt": null
}
],
"internals": [
{
"identifier": "ef7ee722-5f95-415a-9a98-81eeae178b11",
"identifierType": "EMAIL",
"role": "EXTERNAL",
"joinedAt": "2004-04-10T09:00:00.000Z",
"lastSeenAt": null
}
]
},
"createdAt": "2003-04-10T09:00:00.000Z",
"updatedAt": "2003-04-10T09:00:00.000Z",
"name": "Bridge Support Team",
"status": "ACTIVE"
},
"contact": {
"id": "b6cf1c4a-2b1e-4e63-8f3e-0f9d1a2a1234",
"workspaceId": "92b2d4f3-81e1-4b61-a7ec-6f4ff3b58be5",
"type": "NORMAL",
"createdAt": "2003-04-10T08:00:00.000Z",
"updatedAt": "2003-04-10T08:00:00.000Z",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"cellphone": "+14084029292",
"customAttributes": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"languageCode": "EN",
"ownerId": "37673840-6259-40f9-bbe5-a7db40f8e3cf"
},
"templateSent": {
"name": "leadscout_outbound_fb_v1",
"id": "7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f",
"messageId": "7e1d2c3b-4a5f-6e7d-8c9b-0a1b2c3d4e5f"
},
"additionalMessagesPersisted": 0,
"alreadyInitiated": false,
"recovered": false
}Parâmetros de caminho
Corpo
Corpo da solicitação para iniciar uma conversa de saída atendida por um Agent específico.
Controla o que acontece quando nenhuma linha do Agent está livre ou é recuperável. Uma linha livre sempre tem prioridade, seguida de uma linha com uma conversa liberada recuperável com este Contact, qualquer que seja o valor desta opção. Quando nenhuma existe: com false (padrão), a solicitação falha com 409 BRIDGE_AI_LEADSCOUT_0008; com true, uma linha ocupada por uma conversa ativa com este Contact é reutilizada, dando preferência a uma controlada por este Agent. Se a conversa escolhida for controlada por outro Agent ou por um Bridge User, a solicitação falha com 409 BRIDGE_AI_AGENT_OUTBOUND_0006 e nada é gravado; libere-a primeiro e tente novamente. Linhas cuja conversa está bloqueada ou foi liberada sem recuperação nunca são usadas; portanto, se nenhuma linha estiver ocupada por uma conversa ativa, a solicitação falha com 409 BRIDGE_AI_LEADSCOUT_0008 mesmo com true.
false
true
Resposta
Resposta bem-sucedida
Corpo da resposta de uma iniciação de saída bem-sucedida do Agent.
True quando esta solicitação bem-sucedida reutilizou uma conversa ativa existente por forceSend=true. False para criação ou recuperação; consulte recovered para distinguir esses caminhos. É informativo: uma reutilização bem-sucedida também armazena o novo modelo e os acompanhamentos, portanto repetir a solicitação pode adicionar mensagens.
false
true
Esta página foi útil?

