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
str | NoneDefaults to None

The event name or identifier.

Returns

dict — Server response confirming the event was sent.

Example

from signalwire.relay import RelayClient
client = RelayClient(
project="your-project-id",
token="your-api-token",
contexts=["default"],
)
@client.on_call
async def handle_call(call):
await call.answer()
# Send a custom event with metadata
result = await call.user_event(
event="customer_identified",
customer_id="cust-12345",
tier="premium",
)
print(f"User event sent: {result}")
client.run()