# GoHighLevel

> Send new GoHighLevel contacts to CallView from a workflow, and update the contact when the call is over.

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

## Send new contacts

1. In GoHighLevel, open **Automation > Workflows** and make a workflow. Trigger it with "Contact Created", or "Form Submitted" for your quote form.
2. Add a **Custom Webhook** action, set like this, with the body below:

| Setting | Value |
| --- | --- |
| Method | `POST` |
| URL | `https://v2-api.callview.ai/api/v1/external/leads` |
| Headers | `Authorization` = `Bearer cs_live_...` (your secret), `Content-Type` = `application/json`, `Idempotency-Key` = `ghl-{{contact.id}}-create` |
| Body | Raw JSON, with your campaign's ID |

```json
{
  "campaign_id": "7c1f2b9e-4a3d-4e8f-9b21-5d6a7e8f9a01",
  "external_id": "ghl-{{contact.id}}",
  "phone": "{{contact.phone}}",
  "name": "{{contact.name}}",
  "email": "{{contact.email}}",
  "consent": { "source": "web_form", "agreed_at": "{{right_now.iso}}", "url": "https://example.com/quote" },
  "call_now": true
}
```

Check the merge fields against your account: GoHighLevel's names for them can differ. Use a date merge field that gives a full date and time, or a fixed date when you know it.

## Update the contact when the call is over

1. Make a second workflow with the **Inbound Webhook** trigger. Copy the address it gives you.
2. Point a CallView webhook endpoint at that address, with `"events": ["call.completed", "lead.opted_out"]`.
3. Send a sample with `POST /webhook_endpoints/{id}/test` and `{ "type": "call.completed" }`, so GoHighLevel can see the fields.
4. Find the contact by `data.object.lead.external_id` (minus `ghl-`), then update it: put `data.object.outcome` in a custom field, add `data.object.note` as a note, and add a tag such as `callview-interested` so your other workflows can act on it.

GoHighLevel can't check our signature, so keep the inbound webhook address private.
