Skip to content

Campaigns API

Campaigns are the core entity in Heka. A campaign defines a communication initiative with a funnel pipeline, agent instructions, and resources.

Campaign lifecycle

draft → approved → running → completed
                   archived

Campaign pipeline

Each campaign has a pipeline of phases. Contacts enter the pipeline and progress through phases based on conversation signals.

calificacion → agendar → clase_muestra → propuesta → cierre → inscripcion

Phase transitions are gated — only allowed transitions succeed. The AI agent extracts signals from conversations and advances contacts through the pipeline.

Key endpoints

Create a draft

curl -X POST https://heka-operator.fly.dev/campaigns/drafts \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Amate Q3 2026",
    "template_name": "amate_bienvenida_v1",
    "language": "es_MX"
  }'

Get campaign board

Returns campaigns as funnel cards with contact counts per phase.

curl https://heka-operator.fly.dev/campaigns/board \
  -H "Authorization: Bearer $TOKEN"

Move contact through funnel

curl -X POST https://heka-operator.fly.dev/campaigns/{campaign_id}/contacts/{wa_id}/phase \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"phase_id": "clase_muestra"}'

Update phase agent instructions

curl -X PUT https://heka-operator.fly.dev/campaigns/{campaign_id}/phases/{phase_id}/skill \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"instructions": "Eres Gina, asistente de la Escuela Ámate..."}'