Event

Conversations and other Vonage objects such as Members and Applications generate Events. When key activities occur an event is generated, which can be handled by the application. For example when a User joins a Conversation a member:joined event is fired. If a Vonage Application has rtc as a capability, it will receive the dispatched event on the rtc event_url webhook.

Event typeDescription
General
leg:status:update
Audio
audio:dtmfDTMF tone is received into the Leg.
audio:earmuff:offLeg is unearmuffed.
audio:earmuff:onLeg is earmuffed.
audio:mute:offLeg is unmuted.
audio:mute:onLeg is muted.
audio:play:stopAudio streamed into a Leg is stopped.
audio:play:doneAudio streamed into a Leg stops playing, that is the audio data finishes.
audio:playAudio is streamed into a Leg.
audio:record:stop
audio:record:done
audio:recordCall is being recorded.
audio:asr:done
audio:asr:record:done
audio:say:stop
audio:say:done
audio:say
audio:speaking:on
audio:speaking:off
Message
messageMessage (replaces Text and Image events), have subtypes of Text, Image, Audio, Video, File, Template, Custom, VCard, Location, Random. See API Spec for more details
message:rejectedMessage has been rejected.
message:submittedMessage has been submitted.
message:undeliverableMessage can't be delivered.
message:deliveredMessage has been delivered.
message:seenMessage has been seen.
Conversation
conversation:updatedConversation object is updated.
Member
member:invitedMember is invited into a Conversation.
member:joinedMember joins a Conversation.
member:leftMember leaves a Conversation.
member:media
member:message:status
RTC
rtc:status
rtc:transfer
rtc:hangup
rtc:terminate
rtc:answered
rtc:ringing
rtc:answer
SIP
sip:status
sip:answeredSIP call is answered.
sip:machineWhen the entity answering the SIP call is a machine.
sip:hangupUser on a SIP Call hangs up.
sip:ringingSIP call starts ringing, such as when Vonage makes an Outbound Call.
sip:amd_machine
Custom
custom:Custom event types, can be named anything that matches ^custom:[\w\-:]+ for example custom:test
ephemeralEphemeral events that can be sent but cant be retrieved after they have been sent.
Event
event:deleteAn event has been deleted

Handling Events

The following code snippet shows that code can be executed based on the event fired:

...
    events.forEach((value, key) => {
        if (conversation.members[value.from]) {
            const date = new Date(Date.parse(value.timestamp))
            switch (value.type) {
                case 'message:seen':
                    ...
                    break;
                case 'message:delivered':
                    ...
                    break;
                case 'message':
                    ...
                    break;
                case 'member:joined':
                    ...
                    break;
                case 'member:left':
                    ...
                    break;
                case 'member:invited':
                    ...
                    break;
                case 'member:media':
                    ...
                    break;
                default:
                ...
            }
        }
    })
...