Back to Asistn

Asistn API

Let trusted agents read, write, and collaborate with each workspace.

Tokens are generated per workspace from Settings. Each request is tenant-scoped by token, so Agentic Marketing, Coma, or internal tools can only access the workspace that issued it.

Auth

Use a workspace API token in the Authorization header. Tokens are shown once, stored as hashes, and can be copied or deleted from Settings. Tokens are encrypted at rest and still hashed for lookup.

curl https://asistn.com/api/v1/workspace \
  -H "Authorization: Bearer asistn_live_xxx"

Scopes

workspace:read

Read workspace identity and public configuration.

contacts:read

Read contacts and contact metadata.

contacts:write

Create or update contacts.

messages:read

Read conversation list and message history.

messages:send

Send WhatsApp messages from the workspace number.

analytics:read

Read workspace-level analytics summaries.

events:write

Push lead/conversion events.

memory:read

Read AI memory and reflections for trusted internal agents.

audiences:read

Read workspace audience segments and contacts.

insights:read

Read content ideas, customer questions, and growth signals.

Endpoints

GET/api/v1/workspaceworkspace:readWorkspace profile, business settings, active WhatsApp number.
GET/api/v1/contactscontacts:readList contacts with filters: q, status, updated_since, limit.
POST/api/v1/contactscontacts:writeCreate or update a contact by phone.
GET/api/v1/contacts/{id}contacts:readRead one contact.
GET/api/v1/conversationsmessages:readList recent conversations or pass contact_id for messages.
POST/api/v1/messages/sendmessages:sendSend a WhatsApp text and persist it as owner message.
POST/api/v1/leadsevents:writePush a lead from Agentic Marketing, Coma, forms, or other agents.
POST/api/v1/events/conversionevents:writeRecord a conversion event for a contact.
GET/api/v1/analytics/summaryanalytics:readRead compact workspace lead/message/conversion summary.
GET/api/v1/agent-memorymemory:readRead tenant-scoped agent memory, optionally by contact_id.
GET/api/v1/insights/contentinsights:readCustomer questions, objections, memory signals, and content ideas for Coma.
GET/api/v1/audiencesaudiences:readSegment contacts by lead state, lifecycle, recency, or tag.
POST/api/v1/audiences/sendaudiences:read + messages:sendDry-run or send content/template to a segment.

Integration Recipes

Use one token per external app and keep scopes narrow. These flows are the default collaboration pattern between Asistn, Coma, and Agentic Marketing.

Coma
insights:readcontacts:read

Daily content digest from real customer questions

Coma pulls customer questions, objections, pending questions, and AI memory from Asistn, then turns them into FAQ, carousel, short-form scripts, or daily digest content.

  1. 1Call content insights for the workspace.
  2. 2Group repeated questions and objections by theme.
  3. 3Draft content for each theme inside Coma.
  4. 4Optionally write selected content back to your content calendar in Coma.
curl "https://asistn.com/api/v1/insights/content?days=30&limit=50" \
  -H "Authorization: Bearer $ASISTN_API_TOKEN"
Coma
audiences:readmessages:send

Send approved content to an Asistn audience segment

Coma can preview an audience such as ghosted, engaged, qualified, or recent, then send a WhatsApp template or active-window text through Asistn.

  1. 1Dry-run the audience first and review eligible contacts.
  2. 2Use text only for contacts active in the last 24 hours.
  3. 3Use approved WhatsApp templates for older or reactivation audiences.
  4. 4Keep each send tagged by campaign/content id in the payload.
curl https://asistn.com/api/v1/audiences/send \
  -X POST \
  -H "Authorization: Bearer $ASISTN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "segment": "ghosted",
    "dry_run": true,
    "content": "Kami baru publish panduan baru yang mungkin relevan untuk kebutuhan Anda."
  }'
Agentic Marketing
analytics:readcontacts:read

Daily growth and lead quality summary

Agentic Marketing reads Asistn daily performance: lead total, engaged/qualified/ghosted mix, message volume, conversion events, and recent contacts.

  1. 1Fetch analytics summary once per day per workspace.
  2. 2Compare lead, ghosted, qualified, converted, and message metrics with campaign spend.
  3. 3Use contact source/ad_source/meta_data to explain which campaign created better conversations.
  4. 4Create marketing recommendations or budget shifts from the lead quality data.
curl https://asistn.com/api/v1/analytics/summary \
  -H "Authorization: Bearer $ASISTN_API_TOKEN"
Agentic Marketing
events:writecontacts:write

Push campaign leads into Asistn

Agentic Marketing sends leads, campaign metadata, UTM data, and external ids into Asistn so WhatsApp follow-up and AI memory start from the same source of truth.

  1. 1Normalize phone numbers to international format.
  2. 2Send source, external_id, ad_source, and meta_data.
  3. 3Use the same external_id for idempotent updates.
  4. 4Let Asistn continue conversation, status tracking, and conversion attribution.
curl https://asistn.com/api/v1/leads \
  -X POST \
  -H "Authorization: Bearer $ASISTN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "agentic_marketing",
    "external_id": "meta_lead_123",
    "phone": "6281234567890",
    "name": "Albert",
    "intent": "consultation",
    "ad_source": {
      "platform": "meta",
      "campaign": "k-laser-leadgen"
    },
    "meta_data": {
      "tags": ["meta-lead", "k-laser"]
    }
  }'

Examples

Get content signals for Coma

curl "https://asistn.com/api/v1/insights/content?days=30" \
  -H "Authorization: Bearer $ASISTN_API_TOKEN"

Preview a ghosted audience digest

curl https://asistn.com/api/v1/audiences/send \
  -X POST \
  -H "Authorization: Bearer $ASISTN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "segment": "ghosted",
    "dry_run": true,
    "content": "Kami baru publish panduan baru yang mungkin cocok untuk kebutuhan Anda."
  }'

Push a lead from Agentic Marketing

curl https://asistn.com/api/v1/leads \
  -X POST \
  -H "Authorization: Bearer $ASISTN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "agentic_marketing",
    "external_id": "lead_123",
    "phone": "6281234567890",
    "name": "Albert",
    "intent": "laser consultation",
    "payload": { "campaign": "k-laser-meta" }
  }'

Read a conversation

curl "https://asistn.com/api/v1/conversations?contact_id=CONTACT_ID&limit=50" \
  -H "Authorization: Bearer $ASISTN_API_TOKEN"

Send a WhatsApp message

curl https://asistn.com/api/v1/messages/send \
  -X POST \
  -H "Authorization: Bearer $ASISTN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "contact_id": "CONTACT_ID", "content": "Halo, kami bantu follow up ya." }'

Security

Keep tokens server-side

Never put workspace tokens in browser code, mobile apps, or public repositories.

Use the smallest scopes

For analytics tools, use read-only scopes. Add send/write scopes only for trusted automations.

Rotate per integration

Create one token per external tool so you can revoke it without breaking every integration.