pubnub-functions

Build serverless PubNub Functions for message transformation, webhooks, and scheduled intervals.

6|Updated May 26, 2026
One-click install
npx skills add https://github.com/pubnub/skills --skill pubnub-functions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pubnub-functions
Source: https://github.com/pubnub/skills/tree/main/pubnub-functions
Command: npx skills add https://github.com/pubnub/skills --skill pubnub-functions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

PubNub Functions 2.0 enables developers to run serverless edge code that processes and routes PubNub events with low latency, without managing infrastructure.

Core Features & Use Cases

  • Serverless edge functions for PubNub events including publish/subscribe, HTTP endpoints, and scheduled intervals
  • Message transformation, enrichment, webhooks, and external API integrations
  • KVStore-backed state, lightweight analytics triggers, and cross-platform orchestration

Use Case: Imagine enriching every incoming message with user data from KVStore and emitting analytics events for real-time dashboards.

Quick Start

Create a function that reads a user profile from KVStore, enriches an incoming message, and fires an analytics event.

Frequently Asked Questions about pubnub-functions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I transform and enrich PubNub messages in real time without managing servers?

Serverless edge functions process and route PubNub events with low latency, enabling message transformation and enrichment without infrastructure management. You can build functions to intercept published messages, modify payloads, and deliver them to subscribers instantly.

Can I use KVStore to add user data to incoming messages before routing them?

KVStore allows you to read and write stateful data within edge functions. You can enrich incoming messages by fetching user profiles from KVStore, appending the data to the payload, and emitting the updated event for downstream subscribers.

What's the best way to trigger external API integrations from a PubNub event?

Webhooks and HTTP endpoints allow edge functions to trigger external API integrations automatically. You can use the xhr module within your function to send HTTP requests to external services whenever a specific PubNub message is published.

Does PubNub Functions support scheduled interval tasks for periodic data processing?

Scheduled intervals are supported, allowing you to run serverless edge functions periodically. You can configure functions to execute on a timer, enabling lightweight analytics triggers or routine data processing without requiring a manual publish event.

What are the limitations when using async/await patterns in serverless edge functions?

Serverless edge functions have guardrails on operation limits and require robust error handling when using async/await patterns. You must manage asynchronous operations carefully to avoid hitting execution limits or failing silently during external API calls and KVStore access.

How do I secure sensitive credentials used inside my serverless edge functions?

The vault module secures sensitive credentials used inside serverless edge functions. You can store API keys and secrets in the vault, accessing them securely at runtime without hardcoding sensitive values directly in your function logic.