Skip to main content

User received notification

This function is triggered when the system receives an event it identifies as a notification. This is the result of a chat event a user should be notified about occuring. Inside this function you can define custom logic to notify the user of the event that occurred (for example using an email sender or push notification service).

async function handleEvent(event: UserReceivedNotificationEvent, context: Context) {
}

The above function takes two parameters:

  1. The event object which in this case is the UserReceivedNotificationEvent object. This object has three properties:

    • user: The user who has received the notification event.
    • notification: The notification the user has received.
    • userHasActiveSession: This property has the type boolean. It is true if the user has an active user session and is currently online and false otherwise.
  2. A Context object.

note

This is a non-blocking chat function.