For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
ReferenceGuides
ReferenceGuides
  • Core
    • Introduction to SWML
    • Expressions
    • Template functions
    • Variables
    • Errors
  • Calling
    • Overview
    • ai
    • ai_sidecar
    • amazon_bedrock
    • answer
    • cond
    • connect
    • denoise
    • detect_machine
    • enter_queue
    • execute
    • goto
    • hangup
    • join_conference
    • join_room
    • label
    • live_transcribe
    • live_translate
    • pay
    • play
    • prompt
    • receive_fax
    • record
    • record_call
    • request
    • return
    • send_digits
    • send_fax
    • send_sms
    • set
    • sip_refer
    • sleep
    • stop_denoise
    • stop_record_call
    • stop_tap
    • switch
    • tap
    • transcribe
    • transcribe_stop
    • transfer
    • unset
    • user_event
  • Messaging
    • Overview
    • execute
    • goto
    • label
    • receive
    • reply
    • request
    • return
    • switch
    • transfer
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Properties
  • Event Object
  • Examples
  • Send a custom event to the client
  • Send multiple events with different payloads
Calling

user_event

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

Messaging SWML overview

Next
Built with

Allows the user to set and send events to the connected client on the call. This is useful for triggering actions on the client side. Commonly used with the browser-sdk. Accepts an object mapping event names to values. The event object can be any valid JSON object.

user_event
objectRequired

An object that accepts the following properties.

Properties

user_event.event
anyRequired

An object mapping event names to values. The event object can be any valid JSON object.

Event Object

The event parameter can be any valid JSON object. Any key-value pair in the object is sent to the client as an event type called: user_event.

The client can listen for these events using the on-method.

Examples

Send a custom event to the client

1version: 1.0.0
2sections:
3 main:
4 - user_event:
5 event:
6 myCustomEvent: 'Hello, world!'
7 - play:
8 url: 'say: Custom event sent.'

Send multiple events with different payloads

1version: 1.0.0
2sections:
3 main:
4 - user_event:
5 event:
6 eventA:
7 foo: bar
8 eventB:
9 count: 42
10 active: true
11 - play:
12 url: 'say: Multiple events sent.'