RELAYCall

user_event

View as MarkdownOpen in Claude

Send a custom user-defined event on the call. User events allow you to pass application-specific data through the RELAY event system. Other listeners on the same call can receive and react to these events.

Parameters

event
Optional[str]

The event name or identifier.

Returns

dict — Server response confirming the event was sent.

Example

1from signalwire.relay import RelayClient
2
3client = RelayClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7 contexts=["default"],
8)
9
10@client.on_call
11async def handle_call(call):
12 await call.answer()
13
14 # Send a custom event with metadata
15 result = await call.user_event(
16 event="customer_identified",
17 customer_id="cust-12345",
18 tier="premium",
19 )
20 print(f"User event sent: {result}")
21
22client.run()