Listen for Incoming Events

The Messages provider allows you to listen for incoming events using the Messages API.

Method Signature

Types

This function uses the Contact type for the sender and recipient of the message.

MessageContact:

  • type: (String) The channel of the text, e.g. sms, mms, whatsapp, messenger, or viber_service.
  • number: (String) A phone number in in the E.164 format.
  • id: (Optional String) An ID number, for use with Facebook Messenger.

Listening for Events

Using null as a wild card character, you can listen for any incoming events to a specified Vonage number. In this example, incoming message status events will call the onEvent route.