Skip to main content

User sent message

This function is triggered when a user sends a new message. Inside this function you can define custom logic to handle what happens when any user sends a message.

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

The above function takes two parameters:

  1. The event object which in this case is the UserSentMessageEvent object. This object has two properties:

    • user: The user who sent the message.
    • channel: The channel this message was sent.
    • message: The message sent by this user.
  2. A Context object.

note

This is a non-blocking chat function.