Events & Actions

Events & Actions is a no-code feature that watches activity inside PubNub. It forwards matching events to external systems, such as a webhook endpoint, a message queue, or a data lake. You configure it entirely in the Admin Portal, by creating event listeners that watch for specific PubNub events and actions that forward a matched event onward. No SDK code runs on your side to set this up.

How Events & Actions works​

A client app publishes a message, connects, disconnects, or updates metadata, and PubNub generates an event from that activity. Each event listener on the keyset checks the event against its event source and optional filter. On a match, the listener runs the actions attached to it, up to your plan's limit. Each action then forwards the event data to its external system, such as a webhook endpoint or an Amazon SQS queue.

Events, listeners, and actions​

An event is a small record PubNub generates from activity on your keyset. Some events are explicit, a direct result of an API call. Others are implicit. PubNub notices that something happened without your app making an API call.

ScenarioPubNub eventExplicit or implicit
A device calls publish() on a channelMessage sentExplicit. The API call directly produces the event.
A user's phone loses its Internet connectionUser Disconnect, part of PresenceImplicit. PubNub detects the dropped connection without any API call.

An event listener watches one event source for events, optionally narrowed by a filter, such as a specific channel or sender. When an event matches, the listener runs every action attached to it. A listener with no actions attached still runs on a match, but it has nothing to forward. See Event sources for every source and event type a listener can watch, and Available actions for every destination an action can forward to.

Events & Actions vs. Functions​

Events & Actions and Functions both react to activity on your keyset, but they solve different problems.

  • Use Events & Actions to forward event data to a third-party system with no code, when you need visibility into your data outside PubNub.
  • Use Functions when you need to write JavaScript that transforms, validates, blocks, or reroutes a message, or that runs custom logic synchronously in the message path.

Availability by plan​

PubNub Events & Actions limits by tier:

ItemFreeIntroTier 1Tier 2Tier 3Tier 4Tier 5Tier 6
Events ingested per month10K2M4M25M66M200M500MUnlimited
Listeners1UnlimitedUnlimitedUnlimitedUnlimitedUnlimitedUnlimitedUnlimited
Actions per listener133333UnlimitedUnlimited

Your keyset's tier is set by your PubNub plan.

Events & Actions retries are available on paid tiers. The Free tier's single listener does not retry failed deliveries.

Every paid tier retries a failed delivery according to the retry policy you set on the action, described on Available actions.

For the dollar cost of each tier, see Pricing by feature. For the exact event, listener, and action allowances per tier, see Plan comparison.

Billing​

Events & Actions bills by events ingested, not by the actions those events trigger. Every listener on your keyset evaluates every message published to it. Events & Actions calculates the billable count of ingested events by multiplying the messages published to a keyset by the number of active event listeners on that keyset, whether or not an event matches a filter or triggers an action. Each listener you add therefore raises the bill for all published traffic, so count listeners when you design your integration. See Pricing by feature and Plan comparison for the numbers.

Free trial​

Events & Actions includes a two-week free trial. After the trial ends, contact sales to upgrade your plan.

Next steps​

Was this page useful?

Last updated on