During the tour you may want access to your IDE or new windows to see your code working. You’ll get the best experience viewing on a larger device.

Modifying messages based on events

It’s possible to intercept and modify messages before or after they’re sent, whether that’s rule-based, or for every message. A PubNub feature called Functions allows you to do things like re-routing, augmenting, filtering, transforming, and aggregating messages.

In the example below, we're simply adding text to a message but there are many other things you can do with Functions, like using pre-built third-party integrations from over 30 companies including Amazon, Microsoft, and Google.

Services like translation, sentiment analysis, SMS, text-to-speech, content moderation, and more, are delivered through PubNub's powerful serverless environment. Learn more about Functions.

Try it out

Deploy the code to PubNub Functions.

Publish the message and watch it get transformed by the code you just deployed. Make sure the channel names match.

Change " ... And a little bit more" and redeploy the function code.

Send a final message to see your new text added.

Subscribe to my_channel