Chatbot e IA
Crear/Editar trigger
Crea, edita o elimina un trigger de chatbot. Requiere un agente existente (agent_id).
POST
https://api.zapzapapi.com/api/v1/{instanceId}/trigger/editAutenticación con los encabezados x-api-key y x-api-secret.
Parámetros
| Nombre | Tipo | Dónde | Obligatorio | Descripción |
|---|---|---|---|---|
id | text | cuerpo | No | ID del trigger |
delete | select | cuerpo | No | Eliminar |
trigger | json | cuerpo | Sí | Trigger (JSON) |
Ejemplo de solicitud
curl
curl -X POST "https://api.zapzapapi.com/api/v1/{instanceId}/trigger/edit" \
-H "x-api-key: TU_API_KEY" \
-H "x-api-secret: TU_API_SECRET" \
-H "Content-Type: application/json" \
-d '{"trigger":{"active":true,"type":"agent","agent_id":"id_do_agente","ignoreGroups":true,"priority":1,"wordsToStart":"ola|oi|iniciar","responseDelay_seconds":3,"lead_field":"","lead_operator":"","lead_value":""}}'Node.js
const res = await fetch("https://api.zapzapapi.com/api/v1/{instanceId}/trigger/edit", {
method: "POST",
headers: {
"x-api-key": "TU_API_KEY",
"x-api-secret": "TU_API_SECRET",
"Content-Type": "application/json",
},
body: JSON.stringify({
"trigger": {
"active": true,
"type": "agent",
"agent_id": "id_do_agente",
"ignoreGroups": true,
"priority": 1,
"wordsToStart": "ola|oi|iniciar",
"responseDelay_seconds": 3,
"lead_field": "",
"lead_operator": "",
"lead_value": ""
}
}),
});
console.log(await res.json());Python
import requests
res = requests.post(
"https://api.zapzapapi.com/api/v1/{instanceId}/trigger/edit",
headers={"x-api-key": "TU_API_KEY", "x-api-secret": "TU_API_SECRET"},
json={"trigger":{"active":True,"type":"agent","agent_id":"id_do_agente","ignoreGroups":True,"priority":1,"wordsToStart":"ola|oi|iniciar","responseDelay_seconds":3,"lead_field":"","lead_operator":"","lead_value":""}},
)
print(res.json())Ejemplo de respuesta
JSON
{
"id": "rbcca9c181c1e5a",
"active": false,
"type": "agent",
"agent_id": "read16c9f35642c",
"flow_id": "",
"quickReply_id": "",
"ignoreGroups": true,
"lead_field": "",
"lead_operator": "",
"lead_value": "",
"priority": 1,
"wordsToStart": "ola|oi",
"responseDelay_seconds": 3
}Los valores son ilustrativos; los campos siguen el formato real de la respuesta.
Otros endpoints de esta categoría
Consigue tus claves de API
Crea tu cuenta, conecta un número en minutos y empieza a usar la API. R$15 por número activo/mes, con un crédito de bienvenida al crear la cuenta, sujeto a la campaña vigente.
