curl --location --request POST 'https://dashboard.laburen.com/api/agents/cm68elcks00a0y7qaeljq2qin/query-agent' \--header 'Authorization: Bearer 844b4b95-bd79-4583-b6df-83bfa10a8f42' \--header 'Content-Type: application/json' \--data-raw '{ "visitorId": "crmchatsappai_27_REMPLAZAR_ID", "query": "¡Hola [NOMBRE]! Hace un tiempo recibimos tu consulta por el proyecto Osten Tower. Te escribimos para adelantarte el lanzamiento de Osten Tower II. ¡No te pierdas la oportunidad de ser parte de este increíble emprendimiento en Puerto Madero!¿Te gustaría saber más?", "conversationId": "crmchatsappai_27_REMPLAZAR_ID", "streaming": false, "channel": "api"}'
const apiUrl = 'https://dashboard.laburen.com/api';const apiKey = '<API_KEY>';const agentId = 'clxxxxxxxxxxxxxxxxx';// Add agent message to conversationconst response = await fetch(`${apiUrl}/agents/${agentId}/query-agent`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}`, }, body: JSON.stringify({ query: 'Hello! How can I help you today?', visitorId: 'visitor-abc123', conversationId: 'clxxxxxxxxxxxxxxxxx', // Optional: to add to existing conversation channel: 'whatsapp', channelExternalId: 'org123_agent456_+1234567890', // Format: {organizationId}_{agentId}_{telephoneNumber} contact: { phoneNumber: '+1234567890', firstName: 'John', lastName: 'Doe', }, }),});const data = await response.json();console.log('Message ID:', data.messageId);console.log('Conversation ID:', data.conversationId);
import requestsapi_url = "https://dashboard.laburen.com/api"api_key = "<API_KEY>"agent_id = "clxxxxxxxxxxxxxxxxx"# Add agent message to conversationresponse = requests.post( f"{api_url}/agents/{agent_id}/query-agent", headers={ "Content-Type": "application/json", "Authorization": f"Bearer {api_key}", }, json={ "query": "Hello! How can I help you today?", "visitorId": "visitor-abc123", "conversationId": "clxxxxxxxxxxxxxxxxx", # Optional: to add to existing conversation "channel": "whatsapp", "channelExternalId": "org123_agent456_+1234567890", # Format: {organizationId}_{agentId}_{telephoneNumber} "contact": { "phoneNumber": "+1234567890", "firstName": "John", "lastName": "Doe", }, },)data = response.json()print("Message ID:", data["messageId"])print("Conversation ID:", data["conversationId"])
Add agent messages to conversation history. Designed for integrating with external systems like WhatsApp, Chatwoot, and CRM platforms to sync agent messages into the conversation thread.
curl --location --request POST 'https://dashboard.laburen.com/api/agents/cm68elcks00a0y7qaeljq2qin/query-agent' \--header 'Authorization: Bearer 844b4b95-bd79-4583-b6df-83bfa10a8f42' \--header 'Content-Type: application/json' \--data-raw '{ "visitorId": "crmchatsappai_27_REMPLAZAR_ID", "query": "¡Hola [NOMBRE]! Hace un tiempo recibimos tu consulta por el proyecto Osten Tower. Te escribimos para adelantarte el lanzamiento de Osten Tower II. ¡No te pierdas la oportunidad de ser parte de este increíble emprendimiento en Puerto Madero!¿Te gustaría saber más?", "conversationId": "crmchatsappai_27_REMPLAZAR_ID", "streaming": false, "channel": "api"}'
const apiUrl = 'https://dashboard.laburen.com/api';const apiKey = '<API_KEY>';const agentId = 'clxxxxxxxxxxxxxxxxx';// Add agent message to conversationconst response = await fetch(`${apiUrl}/agents/${agentId}/query-agent`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}`, }, body: JSON.stringify({ query: 'Hello! How can I help you today?', visitorId: 'visitor-abc123', conversationId: 'clxxxxxxxxxxxxxxxxx', // Optional: to add to existing conversation channel: 'whatsapp', channelExternalId: 'org123_agent456_+1234567890', // Format: {organizationId}_{agentId}_{telephoneNumber} contact: { phoneNumber: '+1234567890', firstName: 'John', lastName: 'Doe', }, }),});const data = await response.json();console.log('Message ID:', data.messageId);console.log('Conversation ID:', data.conversationId);
import requestsapi_url = "https://dashboard.laburen.com/api"api_key = "<API_KEY>"agent_id = "clxxxxxxxxxxxxxxxxx"# Add agent message to conversationresponse = requests.post( f"{api_url}/agents/{agent_id}/query-agent", headers={ "Content-Type": "application/json", "Authorization": f"Bearer {api_key}", }, json={ "query": "Hello! How can I help you today?", "visitorId": "visitor-abc123", "conversationId": "clxxxxxxxxxxxxxxxxx", # Optional: to add to existing conversation "channel": "whatsapp", "channelExternalId": "org123_agent456_+1234567890", # Format: {organizationId}_{agentId}_{telephoneNumber} "contact": { "phoneNumber": "+1234567890", "firstName": "John", "lastName": "Doe", }, },)data = response.json()print("Message ID:", data["messageId"])print("Conversation ID:", data["conversationId"])
Add agent messages to existing or new conversations
Support for external channel integrations (WhatsApp, Chatwoot, CRM)
Automatic contact creation and association
This endpoint is different from the Query endpoint, which sends user messages and receives AI responses. This endpoint is for adding agent messages to the conversation history.
ID of the conversation to add the message to. Auto-generated if not provided.
For Chatwoot/CRM integrations: The conversationId format is essential to ensure messages are placed in the correct conversation. Use the format crmchatsappai_{accountId}_{customerId} to match existing conversations. Without the correct format, messages may be added to the wrong conversation thread.
Used to link messages from external platforms to conversations in Laburen.
For WhatsApp Embedding: The channelExternalId is essential to ensure messages are placed in the correct conversation. Without it, messages may be added to the wrong conversation thread.
Contact data to create or associate with the conversation. If a contact with matching email, phone number, or userId exists, it will be used. Otherwise, a new contact will be created.
curl --location --request POST 'https://dashboard.laburen.com/api/agents/cm68elcks00a0y7qaeljq2qin/query-agent' \--header 'Authorization: Bearer 844b4b95-bd79-4583-b6df-83bfa10a8f42' \--header 'Content-Type: application/json' \--data-raw '{ "visitorId": "crmchatsappai_27_REMPLAZAR_ID", "query": "¡Hola [NOMBRE]! Hace un tiempo recibimos tu consulta por el proyecto Osten Tower. Te escribimos para adelantarte el lanzamiento de Osten Tower II. ¡No te pierdas la oportunidad de ser parte de este increíble emprendimiento en Puerto Madero!¿Te gustaría saber más?", "conversationId": "crmchatsappai_27_REMPLAZAR_ID", "streaming": false, "channel": "api"}'
const apiUrl = 'https://dashboard.laburen.com/api';const apiKey = '<API_KEY>';const agentId = 'clxxxxxxxxxxxxxxxxx';// Add agent message to conversationconst response = await fetch(`${apiUrl}/agents/${agentId}/query-agent`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}`, }, body: JSON.stringify({ query: 'Hello! How can I help you today?', visitorId: 'visitor-abc123', conversationId: 'clxxxxxxxxxxxxxxxxx', // Optional: to add to existing conversation channel: 'whatsapp', channelExternalId: 'org123_agent456_+1234567890', // Format: {organizationId}_{agentId}_{telephoneNumber} contact: { phoneNumber: '+1234567890', firstName: 'John', lastName: 'Doe', }, }),});const data = await response.json();console.log('Message ID:', data.messageId);console.log('Conversation ID:', data.conversationId);
import requestsapi_url = "https://dashboard.laburen.com/api"api_key = "<API_KEY>"agent_id = "clxxxxxxxxxxxxxxxxx"# Add agent message to conversationresponse = requests.post( f"{api_url}/agents/{agent_id}/query-agent", headers={ "Content-Type": "application/json", "Authorization": f"Bearer {api_key}", }, json={ "query": "Hello! How can I help you today?", "visitorId": "visitor-abc123", "conversationId": "clxxxxxxxxxxxxxxxxx", # Optional: to add to existing conversation "channel": "whatsapp", "channelExternalId": "org123_agent456_+1234567890", # Format: {organizationId}_{agentId}_{telephoneNumber} "contact": { "phoneNumber": "+1234567890", "firstName": "John", "lastName": "Doe", }, },)data = response.json()print("Message ID:", data["messageId"])print("Conversation ID:", data["conversationId"])
{ "visitorId": "{{$json.contacts[0].wa_id}}", "query": "{{ $('Combino mensaje con cada fletero').last().json.mensaje}}", "streaming": false, "channel": "whatsapp", "channelExternalId": "{organizationId}_{agentId}_{{$json.contacts[0].wa_id}}"}
The channelExternalId format: {organizationId}_{agentId}_{telephoneNumber}
Critical: The channelExternalId is essential for WhatsApp Embedding integration. Without it, messages will not be placed in the correct conversation thread. Always include this field with the exact format {organizationId}_{agentId}_{telephoneNumber} when using WhatsApp channel.
Critical: The conversationId format is essential for Chatwoot/CRM integrations. Use the exact format crmchatsappai_{accountId}_{customerId} to match existing conversations. Without the correct format, messages will not be placed in the correct conversation thread.