Welcome to the new Daily Docs. Please let us know what you think.

sendAppMessage()

sendAppMessage({data}, to)

Sends a message to other participants, or another specific participant, during the call.

data should be a javascript object that can be serialized into JSON.

to should be either a participant session_id, or "*". The "*" value is the default, and means that the message is a "broadcast" message intended for all participants.

Note that the to address is the session_id, not the user_id.

Messages are delivered to participants currently in the call. They are not stored. If a recipient is not in the call when the message is sent, the recipient will never receive the message.

Broadcast messages are not delivered to the sender of the message.

Returns this.

You can listen for these messages by installing a handler for the app-message event.

sendAppMessage() in action

We used sendAppMessage() to add chat to our React call object demo app: