PubNub Functions

A serverless environment to execute functions on the edge, transforming, enriching, and filtering messages as they route through the PubNub network

PubNub Functions enable the creation and execution of business logic on messages at the edge of the network. Quickly build microservices and incorporate logic like re-routing, augmenting, filtering, transforming, and aggregating data. PubNub Functions are serverless, there is no need to worry about deploying, maintaining, or scaling server infrastructure.

PubNub Functions

What Can You Do with PubNub Functions?


Route, filter, transform, augment, and aggregate real-time messages.


One-click secure REST endpoint functions make new functionality a breeze to build and deploy.


Trigger sync and async functions so processing can happen as data streams in or afterwards.


Enrich messages with HTTP calls to 3rd party APIs and services.

Example Use Cases

Utilizing IoT sensors

Utilizing IoT sensors and serving an event when there is a temperature anomaly.

Translating multi-language chat

Translating multi-language chat conversations in-network.

Deploying chatbots

Deploying chatbots to enrich conversations in social platforms.

Making Real-time Innovation Work

Low Latency

Your logic is executed where your data is streaming in, and replicated across PubNub’s 15 Points of Presence. PubNub guarantees less than 10ms triggered execution time for Functions.

  • 11:30:14 block: Deploying in regions: Eastern US,
  • Western US, Asia, Western Europe,
  • Central Europe, South America.
  • 11:30:15 block: Module is now globally deployed
Enterprise Grade

PubNub Functions maintain a global key/value store to keep the application state. They deploy and scale automatically, so you do not have to worry about operational issues.

Enterprise-grade security comes built in, including:

  • AES message encryption
  • HIPAA Compliance, SOC 2 Compliant
  • Data Shield certified, and EU-only Data Storage options
  • Vault - a secure store for private information, such as passwords or API keys
  • var pubnub = new PubNub({
  • subscribeKey: ‘subscribeKey’,
  • publishKey: ‘publishKey’,
  • cipherKey: ‘cipherKey’ //secret key used to create AES signature
  • });

Never worry about servers and infrastructure issues. PubNub Functions scales automatically as users and devices increase, and handles all the deployment of your code.

  • Create
  • /v1/blocks/key/178088/event_handler
  • Start
  • /v1/blocks/key/178088/block/71/start
  • Stop
  • /v1/blocks/key/178088/block/71/stop
Multiple Ways to Access

Endpoints triggers an event handler and assigns a URL to your function to execute it with an HTTP request. You can also modify data with event-based triggers, before publishing and/or after publishing.

  • Before Publish or Fire
  • After Publish or Fire
  • After Presence
  • On Request
YourTestRest COPY URL

Get Started Even Quicker with BLOCKS

The BLOCKS Catalog is a growing collection of prebuilt applets for chat, alerts, geolocation, graphing, IoT, and more, and are replicated across the edge of the PubNub network.

PubNub has partnered with dozens of leading companies to provide easily integratable partner functions to suit your use cases.

See the Entire Catalog
Asset 48 Analyze, sort, categorize and tag images sent via chat Translate chat messages to 11 different languages Trigger an email based on user interaction or if a user is offline ImageRecognitionand Analysis Language Translator Transactional Email

Getting Started

Functions Quickstart

Functions Quickstart

Setting up and deploying a function with PubNub.

Read Quickstart

Functions Tutorials

Functions Tutorials

Tutorials for using different types of functions.

Read Tutorials

API Documentation

API Documentation

Comprehensive technical docs and best practices.

Read Documentation

Ready To Get Started?

Contact Sales