> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trikon.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# n8n

> Start Trikon Voice calls and capture post-call webhooks from an n8n workflow.

[n8n](https://n8n.io) is a workflow tool (self-hosted or cloud). Use an **HTTP Request** node to call Trikon, and a **Webhook** node if you want call results back in the same workflow.

The existing API overview already calls out n8n as a way to trigger reminder calls from a CRM or form.

## Before you start

* n8n instance you control (so the API key is not shared with a public template).
* Trikon API key, workspace slug, outbound agent ID, and phone-line UUID.

## Store the API key as a credential

In n8n, create a **Header Auth** credential:

| Field | Value                 |
| ----- | --------------------- |
| Name  | `Authorization`       |
| Value | `Bearer YOUR_API_KEY` |

Use that credential on every HTTP Request node that talks to Trikon. Do not put the key in a Set node that gets logged.

## Start an outbound call

<Steps>
  <Step title="Trigger">
    Use whatever starts the flow — **Webhook** (form submit), **Schedule**, Google Sheets, HubSpot, etc. Map a phone number in E.164 (`+91…`).
  </Step>

  <Step title="HTTP Request">
    * Method: `POST`
    * URL: `https://voice.trikon.tech/api/outbound-call`
    * Authentication: the Header Auth credential above
    * Content type: JSON
    * Body:

    ```json theme={null}
    {
      "to": "{{ $json.phone }}",
      "agentId": "8f2c1d34-5b6a-4c7e-9f10-2a3b4c5d6e7f",
      "enterprise": "acmeclinic",
      "from": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "name": "{{ $json.name }}",
      "metadata": {
        "amount_due": "{{ $json.amount_due }}",
        "due_date": "{{ $json.due_date }}"
      }
    }
    ```
  </Step>

  <Step title="Save the call id">
    The response includes `success` and `callUuid`. Write `callUuid` back to your sheet or CRM so you can match the later webhook.
  </Step>
</Steps>

Field reference: [Make a call](/developers/make-a-call).

## Create a lead, then call it

If you want the contact to appear in **Leads** first:

1. `POST https://voice.trikon.tech/api/developer/leads` with JSON:

   ```json theme={null}
   {
     "enterprise": "acmeclinic",
     "agentId": "8f2c1d34-5b6a-4c7e-9f10-2a3b4c5d6e7f",
     "name": "{{ $json.name }}",
     "phone": "{{ $json.phone }}",
     "notes": "{{ $json.notes }}",
     "source": "n8n"
   }
   ```

   A `201` response includes `lead.id`.

2. Optionally `POST https://voice.trikon.tech/api/developer/leads/{{ $json.lead.id }}/call` with the same Bearer header to ring that lead immediately.

Phone can also be sent as `phone_number` or `mobile` — the developer leads endpoint accepts several aliases.

## Receive post-call events

<Steps>
  <Step title="Add a Webhook node">
    Create a workflow with a **Webhook** trigger, method `POST`, path e.g. `trikon-call`. Copy the production URL.
  </Step>

  <Step title="Paste it into Trikon">
    **Settings → Developer API → Call webhook**.
  </Step>

  <Step title="Respond immediately">
    Set the Webhook node to respond with `200` as soon as the body is received. n8n should not wait on CRM updates — Trikon retries if you take longer than about 3 seconds.
  </Step>

  <Step title="Branch on event">
    Switch on `{{ $json.event }}`: `call.completed`, `call.no_answer`, `call.failed`, `recording.ready`, `analysis.completed`. Use `intent` and `summary` when `analysis.completed` arrives.
  </Step>
</Steps>

Payload details: [Webhooks](/developers/webhooks).

## Trigger n8n Workflows Live During Phone Calls

You can also have your AI Voice Agent trigger an n8n webhook **in the middle of a live voice call** to fetch or submit data (e.g. checking CRM records or triggering instant WhatsApp notifications while speaking with the caller).

1. In n8n, create a **Webhook** node (`POST`).
2. In Trikon Voice, open your agent and go to **Custom Tools**.
3. Click **Add Custom Tool**, set Method to `POST`, and paste your n8n webhook URL.
4. Add parameters (e.g. `customer_name`, `intent`, `phone_number`).
5. When the caller speaks, the AI will call your n8n workflow in real time, receive the response, and speak it naturally!

See full guide: [Custom Tools & APIs](/user-guide/custom-tools).

<Tip>
  Test with your own phone in n8n’s manual execution first. When `success` is `true`, the row should show up in **Call Logs** within a few seconds of the call ending.
</Tip>
