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

# LiveKit Webhook & CRM Integration — HMAC-Signed Events

> Push Vobiz call events to your CRM in real time using HMAC-signed webhooks and LiveKit function tools - end-to-end Python example with sample payloads.

Stream call events to your CRM during a live conversation using LiveKit function tools and HMAC-signed webhooks.

> [card] [View on GitHub](https://github.com/vobiz-ai/Livekit-Vobiz-Webhook-Integration-Example)
>
> Clone and run the full working example

## Getting started

```bash theme={null}
git clone https://github.com/vobiz-ai/Livekit-Vobiz-Webhook-Integration-Example.git
cd Livekit-Vobiz-Webhook-Integration-Example
pip install -r requirements.txt
python agent.py dev
```

## Overview

The agent loads call metadata from your CRM before the call connects, then dispatches signed webhook events throughout the call lifecycle. During the conversation, the agent has access to four function tools that send non-blocking HTTP POSTs to your backend without interrupting the audio stream.

## Agent function tools

| Tool | Description |
| - | - |
| `record_intent` | Log a custom intent note to the CRM mid-call |
| `lookup_crm` | Fetch customer data by phone number |
| `update_crm_note` | Append a note to the active customer record |
| `transfer_call` | Transfer the caller to a human agent via SIP REFER |

## Webhook events

| Event | When it fires |
| - | - |
| `call.started` | Immediately when the agent joins the room |
| `call.ended` | When the call disconnects |
| `intent.recorded` | When the agent calls `record_intent` |
| `crm.updated` | When the agent calls `update_crm_note` |

All webhook payloads are signed with HMAC SHA-256 using your `WEBHOOK_SECRET`.

## Key code

```python theme={null}
@llm.function_tool(description="Log a custom intent note to the CRM mid-call")
async def record_intent(context: llm.FunctionContext, intent: str):
    """Asynchronous webhook POST executed during audio streaming"""
    async with aiohttp.ClientSession() as session:
        await session.post(
            f"{CRM_URL}/webhooks/intent",
            json={"intent": intent, "call_id": call_id},
            headers={"X-Signature": compute_hmac(payload)}
        )
```

## Environment variables

```bash .env theme={null}
LIVEKIT_URL=wss://your-project.livekit.cloud
LIVEKIT_API_KEY=APIxxxxxxxxxxxxx
LIVEKIT_API_SECRET=secretxxxxxxxxxx
CRM_URL=https://your-crm.example.com
WEBHOOK_SECRET=your-hmac-secret
OPENAI_API_KEY=sk-...
```

## Related LiveKit templates

* [LiveKit inbound calling](https://www.vobiz.ai/docs/examples/livekit-vobiz-inbound.md) - route calls to a Vobiz number into a LiveKit agent over a SIP trunk.
* [LiveKit outbound calling](https://www.vobiz.ai/docs/examples/livekit-vobiz-outbound.md) - place calls from a LiveKit agent through a Vobiz SIP trunk.
* [Call transfer](https://www.vobiz.ai/docs/examples/vobiz-livekit-call-transfer-example.md) - transfer a live call to any phone number with SIP REFER.
* [DTMF IVR](https://www.vobiz.ai/docs/examples/vobiz-livekit-ivr-dtmf-example.md) - an IVR menu that accepts keypad input as well as speech.
* [Agent-to-agent handoff](https://www.vobiz.ai/docs/examples/vobiz-livekit-agent-to-agent-handoff-example.md) - pass a call to a specialist agent with the conversation context.
* [Answering machine detection](https://www.vobiz.ai/docs/examples/livekit-vobiz-machine-detection-agent-example.md) - tell a human from voicemail before the agent speaks.
* [All features in one agent](https://www.vobiz.ai/docs/examples/livekit-vobiz-all-feature-example.md) - inbound, outbound, transfers, DTMF, AMD, and webhooks together.

To build an agent without LiveKit, see [Bare-metal XML](https://www.vobiz.ai/docs/examples/vobiz-all-xml.md), which streams call audio over a WebSocket with no third-party SDK, or [Vobiz + Pipecat](https://www.vobiz.ai/docs/examples/vobiz-x-pipecat.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.