Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions plivo-chatbot/outbound/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ When `ENV=production`, the server automatically routes WebSocket connections to

As you did before, initiate a call via `curl` command to trigger your bot to dial a number.

## Accessing Call Information in Your Bot
## Accessing Custom Data in Your Bot

Your bot automatically receives caller information through query parameters in the WebSocket URL. The server extracts the `From` and `To` phone numbers and passes them as `body` data to your bot via the WebsocketRunnerArguments (coming soon!).
Your bot receives custom data through `runner_args.body`:

```python
async def bot(runner_args: RunnerArguments):
body_data = runner_args.body or {}
first_name = body_data.get("user", {}).get("firstName", "there")
# Use first_name to personalize greetings, prompts, etc.
```

This approach works consistently in both local development and Pipecat Cloud production deployments.
8 changes: 2 additions & 6 deletions plivo-chatbot/outbound/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,8 @@ async def websocket_endpoint(
from bot import bot
from pipecat.runner.types import WebSocketRunnerArguments

# Create runner arguments and run the bot
runner_args = WebSocketRunnerArguments(websocket=websocket)
runner_args.handle_sigint = False

# TODO: When WebSocketRunnerArguments supports body, add it here:
# runner_args = WebSocketRunnerArguments(websocket=websocket, body=body_data)
# Create runner arguments with body data
runner_args = WebSocketRunnerArguments(websocket=websocket, body=body_data)

await bot(runner_args)

Expand Down