Skip to content

How every recipe works

Every CRM recipe here is the same three moves. Once you know them, any CRM or automation tool will do.

When a lead lands in your CRM, send it to POST /leads:

Setting Value
Method and address POST https://v2-api.callview.ai/api/v1/external/leads
Login HTTP Basic with your key ID and secret, or the header Authorization: Bearer cs_live_...
Idempotency-Key header Something from the CRM record, like crm-<record id>-create, so a retry can’t make two leads
Body JSON with only the fields below. Unknown fields are refused, so don’t send the CRM’s whole record.
{
"campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01",
"external_id": "<the CRM record id>",
"phone": "<the phone>",
"name": "<first and last name>",
"email": "<email>",
"fields": { "source": "<where the lead came from>" },
"consent": { "source": "web_form", "agreed_at": "<when they agreed>", "url": "<the form's page>" },
"call_now": true
}

external_id is what ties everything together: every call and event about this lead carries it back to you.

Make a webhook endpoint that points at your tool’s “receive a webhook” address:

Terminal window
curl -X POST 'https://v2-api.callview.ai/api/v1/external/webhook_endpoints' \
-u "$CALLVIEW_KEY_ID:$CALLVIEW_SECRET" \
-H 'Content-Type: application/json' \
-d '{ "url": "https://hooks.example.com/your-tool-address", "events": ["call.completed", "lead.opted_out"] }'

Keep the whsec_ secret from the reply. If your tool can run a little code, check the signature. If it can’t, keep the address private: it’s the only thing standing between a stranger and your CRM.

From the event, the fields you’ll want:

From the event Put it in the CRM as
data.object.lead.external_id Which record to update
data.object.outcome A dropdown with the outcome words
data.object.outcome_label The outcome as your team names it
data.object.note A note on the record
data.object.handled_by.name Who spoke to them
data.object.callback_at A task or a follow-up date
data.object.duration_seconds Call length

For the recording or the transcript, call GET /calls/{id}/recording or GET /calls/{id}/transcript (the paths are in recording_path and transcript_path). A recording link works for 5 minutes, so fetch it when someone wants to listen. Don’t save the link itself.

lead.opted_out means the person asked not to be called. Mark them do-not-call in the CRM too.

Use a test key and the magic numbers while you wire it up. +15550100001 gives you an interested lead in about 4 minutes, and +15550100002 a voicemail in about a minute. When it all works, change the key and the webhook endpoint to live ones.