curl -X POST "https://suasofia.online/api/conversations" \
-H "Content-Type: application/json" \
-d '{
"assistant_id": "550e8400-e29b-41d4-a716-446655440000",
"type": "widget",
"variables": {
"customer_name": "John Smith",
"company": "Acme Corp",
"source": "pricing_page"
}
}'
const response = await fetch('https://suasofia.online/api/conversations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
assistant_id: '550e8400-e29b-41d4-a716-446655440000',
type: 'widget',
variables: {
customer_name: 'John Smith',
company: 'Acme Corp',
source: 'pricing_page'
}
})
});
const data = await response.json();
console.log(data.conversation_id);
import requests
response = requests.post(
'https://suasofia.online/api/conversations',
json={
'assistant_id': '550e8400-e29b-41d4-a716-446655440000',
'type': 'widget',
'variables': {
'customer_name': 'John Smith',
'company': 'Acme Corp',
'source': 'pricing_page'
}
}
)
data = response.json()
print(data['conversation_id'])
{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": [
{
"role": "assistant",
"content": "Olá John Smith! Bem-vindo ao suporte da Acme Corp. Como posso ajudá-lo hoje?"
}
]
}
{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": []
}
{
"status": false,
"error": "Assistente não encontrado"
}
{
"status": false,
"error": "Saldo insuficiente. Por favor, recarregue sua conta."
}
Conversas
Criar Conversa
Crie uma nova sessão de conversa com um assistente de IA
POST
/
conversations
curl -X POST "https://suasofia.online/api/conversations" \
-H "Content-Type: application/json" \
-d '{
"assistant_id": "550e8400-e29b-41d4-a716-446655440000",
"type": "widget",
"variables": {
"customer_name": "John Smith",
"company": "Acme Corp",
"source": "pricing_page"
}
}'
const response = await fetch('https://suasofia.online/api/conversations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
assistant_id: '550e8400-e29b-41d4-a716-446655440000',
type: 'widget',
variables: {
customer_name: 'John Smith',
company: 'Acme Corp',
source: 'pricing_page'
}
})
});
const data = await response.json();
console.log(data.conversation_id);
import requests
response = requests.post(
'https://suasofia.online/api/conversations',
json={
'assistant_id': '550e8400-e29b-41d4-a716-446655440000',
'type': 'widget',
'variables': {
'customer_name': 'John Smith',
'company': 'Acme Corp',
'source': 'pricing_page'
}
}
)
data = response.json()
print(data['conversation_id'])
{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": [
{
"role": "assistant",
"content": "Olá John Smith! Bem-vindo ao suporte da Acme Corp. Como posso ajudá-lo hoje?"
}
]
}
{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": []
}
{
"status": false,
"error": "Assistente não encontrado"
}
{
"status": false,
"error": "Saldo insuficiente. Por favor, recarregue sua conta."
}
Este endpoint cria uma nova sessão de conversa com um assistente de IA. Use isso para iniciar uma sessão de chat baseada em texto através do seu widget ou aplicativo web.
Corpo da Requisição
string
required
O UUID do assistente com o qual iniciar a conversa. Deve ser um UUID de assistente válido que exista no sistema.
string
default:"widget"
O tipo de conversa. Valores possíveis:
widget- Conversa via widget web (padrão, cobrado)test- Conversa de teste (gratuita, para desenvolvimento)
object
Variáveis personalizadas a serem passadas para o assistente. Essas variáveis podem ser usadas no prompt do sistema do assistente e na mensagem inicial usando a sintaxe
{{variable_name}}.Casos de uso comuns:- Pré-preencher informações do cliente a partir de formulários
- Passar contexto do seu aplicativo
- Personalizar o comportamento do assistente por sessão
Campos de Resposta
boolean
Indica se a requisição foi bem-sucedida
string
O identificador UUID único para a conversa criada. Use este ID para requisições de mensagens subsequentes.
array
Respostas de Erro
boolean
Será
false quando ocorrer um errostring
Mensagem de erro descrevendo o que deu errado. Valores possíveis:
Assistente não encontrado- O assistant_id fornecido não existeSaldo insuficiente. Por favor, recarregue sua conta.- O saldo da conta do proprietário do assistente está muito baixo
curl -X POST "https://suasofia.online/api/conversations" \
-H "Content-Type: application/json" \
-d '{
"assistant_id": "550e8400-e29b-41d4-a716-446655440000",
"type": "widget",
"variables": {
"customer_name": "John Smith",
"company": "Acme Corp",
"source": "pricing_page"
}
}'
const response = await fetch('https://suasofia.online/api/conversations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
assistant_id: '550e8400-e29b-41d4-a716-446655440000',
type: 'widget',
variables: {
customer_name: 'John Smith',
company: 'Acme Corp',
source: 'pricing_page'
}
})
});
const data = await response.json();
console.log(data.conversation_id);
import requests
response = requests.post(
'https://suasofia.online/api/conversations',
json={
'assistant_id': '550e8400-e29b-41d4-a716-446655440000',
'type': 'widget',
'variables': {
'customer_name': 'John Smith',
'company': 'Acme Corp',
'source': 'pricing_page'
}
}
)
data = response.json()
print(data['conversation_id'])
{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": [
{
"role": "assistant",
"content": "Olá John Smith! Bem-vindo ao suporte da Acme Corp. Como posso ajudá-lo hoje?"
}
]
}
{
"status": true,
"conversation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"history": []
}
{
"status": false,
"error": "Assistente não encontrado"
}
{
"status": false,
"error": "Saldo insuficiente. Por favor, recarregue sua conta."
}
Preços
- Conversas via widget: R$0,01 por mensagem de usuário
- Conversas de teste: Gratuitas (para desenvolvimento e testes)

