# Make

> Two Make scenarios. One sends new leads to CallView, one writes call outcomes back to your CRM.

This follows the three moves in [How every recipe works](https://developers.callview.ai/recipes/).

## Scenario 1: send new leads

Start with your CRM's "Watch new contacts" module, then add **HTTP > Make a request**:

| Setting | Value |
| --- | --- |
| URL | `https://v2-api.callview.ai/api/v1/external/leads` |
| Method | `POST` |
| Headers | `Authorization` = `Bearer cs_live_...`, `Idempotency-Key` = `make-` plus the contact's ID |
| Body type | Raw, with content type JSON (application/json) |
| Request content | The JSON from [How every recipe works](https://developers.callview.ai/recipes/#1-send-each-new-lead), with your fields mapped in |
| Parse response | Yes |

Add an error handler for the HTTP module. A `409` (already sent) or `422` (on the Do Not Call list, say) is an answer: ignore it. A `429` or `5xx` can be retried: use Make's Break directive so it tries again later.

## Scenario 2: write outcomes back

1. Start with **Webhooks > Custom webhook**, and copy the address it gives you.
2. Point a CallView webhook endpoint at it, with `"events": ["call.completed", "lead.opted_out"]`. Send a sample with `POST /webhook_endpoints/{id}/test` so Make learns the fields.
3. Add a Router with one route for `type` = `call.completed` and one for `lead.opted_out`.
4. On the `call.completed` route, use your CRM's "Search contacts" by `data.object.lead.external_id`, then "Update a contact" with `data.object.outcome`, `data.object.note` and `data.object.handled_by.name`.
5. On the `lead.opted_out` route, mark the contact do-not-call.

To check the signature in Make, turn on "Get request headers" and "JSON pass-through" in the webhook's advanced settings, so you have the raw body and the `CallView-Signature` header. Then compare `v1` with `sha256(t + "." + body; "hex"; your whsec_ secret)` and stop the scenario when they differ, or when `t` is more than 5 minutes old. If that's more than you want to build, keep the webhook address private.
