Configure Events & Actions

The Events & Actions section in the Admin Portal allows for creating, editing, and deleting event listeners and specific actions that these listeners handle.

Event Listeners

The Event Listeners section allows you to see the number and type of event listeners you created, their status, and the number of actions they're connected to. Upon hovering, you can see the name of the action linked to the event listener. For more information, read how to create event listeners.

event listener section

Actions

The Actions section allows you to see the number and type of actions you created, their status, and the number of event listeners they're connected to. Upon hovering, you can see the name of the event listener linked to the action. For more information, read how to create actions.

Action feedback

Create Event Listener

To create an event listener:

  1. Open Admin Portal and choose Events & Actions.

  2. Select your app and the corresponding keyset.

  3. Click the + Add Event Listener button and select the event source for your listener. For more information about event sources, refer to Event source.

    Action feedback

  4. Choose the event producer and event type.

    Available producers and types

    If you don't see your desired event type, choose a different event source.

  5. Select a filter type for the event listener from the dropdown list. Depending on your event source and type selection, the flow for creating an event listener varies.

    NameDescription
    No filterNo filtering done on conditions. Selecting this option triggers actions for all messages.
    Basic filtersPredetermined conditions triggering an action selected from the UI.
    Advanced JSONPathConditions triggering an action in a JSONPath format.
  6. You can pair your event listener with a previously created action without leaving the Event Listeners view. Search for the desired action in the Add Action dropdown to do this.

  7. Save your newly created event listener by clicking the Save Changes button.

Filter types

There are three types of filters available:

No filter

This filter doesn't require any configuration. Selecting this option triggers actions for all messages.

Basic filters

After choosing Basic filters, you will see two dropdown lists, Filters and Conditions, and an input field labeled Value.

  1. From the Filters dropdown list, select one of the available filters.

    NameDescription
    ChannelTrigger an action after a message is published on a specific channel.
    Sender IDTrigger an action after a message is published by a specific sender.
  2. From the Conditions dropdown list, select one of the available conditions.

    NameDescription
    Exact MatchTrigger an action only if there is an exact match.
    ContainsTrigger an action if the specified value is found.
  3. In the Value field, type the value that must meet the selected condition. For example, choosing the exact match by the channel name Matrix will create an event listener that will trigger an action on every message published in the Matrix channel.

Advanced JSONPath

Utilizing JSONPath allows for a much more robust setup of event handlers than basic filters.

You can use JSONPath to define the following conditions to trigger an action:

Condition nameData typeDescription
channelstringName of the channel the message was sent to.
messageanyMessage content.
metaanyCustom metadata.
uuidstringSender ID.
User ID / UUID

User ID is also referred to as UUID/uuid in some APIs and server responses but holds the value of the userId parameter you set during initialization.

To recreate the example from Basic Filters, you can use the following JSONPath query:
$.[?(@.channel == "Matrix")]. This will trigger an action when your message is published to the Matrix channel.

Create Action

Choose the category of your action and follow the configuration steps for each action category.

NameDescription
WebhookAllows for a third-party service integration.
Amazon SQSAllows you to use a third-party message queuing service.
Amazon KinesisAllows you to use a real-time, streaming data analysis service.
Amazon S3 with batchingAllows you to use third-party object storage service.
Apache KafkaAllows you to export events to an Apache Kafka event streaming platform.

Webhook payload example

The following JSON is an example of a webhook payload that is triggered when the message Wake up, Neo... is sent by Client-w5h0y on the channel Matrix.

User ID / UUID

User ID is also referred to as UUID/uuid in some APIs and server responses but holds the value of the userId parameter you set during initialization.

{
"event": {
"channel": "Matrix",
"eventCategory": "message",
"eventType": "message.publish",
"eventId": "a2748829-a16e-4ce7-b3ed-67021d2c7c65",
"eventPayload": {
"message": "{\"text\":\"Wake up, Neo...\"}",
"meta": {}
},
"iso8601timestamp": "2023-11-28T12:31:32Z",
"subscribeKey": "sub-c-95c7895c-b977-4728-bebe-f2e5db1b4f90",
"timetoken": "17011746925168240",
"senderId": "Client-w5h0y"
},
show all 32 lines

For more information about webhook payloads, refer to Webhooks.

Last updated on