Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.vocode.dev/llms.txt

Use this file to discover all available pages before exploring further.

Now that we have our receptionist Agent configured, we want to set up an automation so that every time we receive a call, we can process the results once the call has ended.

Setting up our webhook

We’ll use the Webhooks feature on the Agent to configure our automations. First, let’s create a webhook that posts to "https://example.com" every time a call ends.
Python
from vocode import AgentUpdateParams, EventType, HttpMethod, WebhookUpdateParams

new_webhook = WebhookUpdateParams(
    subscriptions=[EventType.EVENT_PHONE_CALL_ENDED],
    url="https://example.com",
    method=HttpMethod.POST,
)
Now, we can add this to our Agent by using the agent/update endpoint like before:
Python
update_response = vocode_client.agents.update_agent(
    id=agent_id,
    request=AgentUpdateParams(
        webhook=new_webhook.id
    ),
)

Sample webhook server

In order to process the result of our webhook, we can set up a simple endpoint to receive webhook messages from Vocode. Webhook.site makes it very easy to set up a sample endpoint. For a full list of webhook events and other capabilities, check out our guide on Webhooks.