Chatbot and AI

Create/Edit Trigger

Creates, edits or deletes a chatbot trigger. Requires an existing agent (agent_id).

POSThttps://api.zapzapapi.com/api/v1/{instanceId}/trigger/edit

Authentication with the x-api-key and x-api-secret headers.

Parameters

NameTypeInRequiredDescription
idtextbodyNoTrigger ID
deleteselectbodyNoDelete
triggerjsonbodyYesTrigger (JSON)

Request example

curl

curl -X POST "https://api.zapzapapi.com/api/v1/{instanceId}/trigger/edit" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-api-secret: YOUR_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": "YOUR_API_KEY",
    "x-api-secret": "YOUR_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": "YOUR_API_KEY", "x-api-secret": "YOUR_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())

Response example

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
}

Values are illustrative; the fields follow the real response format.

See the full reference

Get your API keys

Create your account, connect a number in minutes and start using the API. R$15 per active number/month, with a welcome credit when you create the account, subject to the current campaign.