pubnub-functions
Installation
SKILL.md
PubNub Functions 2.0
Core Workflow
- Identify Function Type: Before Publish, After Publish, On Request, or On Interval
- Design Logic: Plan the transformation, integration, or business logic
- Implement Function: Write async/await code with proper error handling
- Use Modules: Leverage kvstore, xhr, vault, pubnub, crypto modules
- Validate Implementation: Verify no hardcoded secrets (use vault), confirm async/await usage (no .then() chains), check operation count stays within the 3-operation limit, and ensure proper try/catch wrapping
- Handle Response: Return ok()/abort() or send() appropriately
- Configure Channel Patterns: Set wildcard patterns ending with
.*, max two literal segments before wildcard - Test in Staging: Test the function in PubNub Admin Portal with sample messages before enabling on production channels
- Deploy to Production: Enable the function on live channel patterns and monitor logs
Reference Guide
| Reference | Purpose |
|---|---|
| functions-basics.md | Function structure, event types, async/await patterns |
Related skills
More from pubnub/skills
pubnub-app-developer
Build real-time applications with PubNub pub/sub messaging
27pubnub-chat
Build chat applications with PubNub Chat SDK
25pubnub-presence
Implement real-time presence tracking with PubNub
24pubnub-security
Secure PubNub applications with Access Manager, encryption, and TLS
24pubnub-live-betting-casino
Build real-time betting and casino game platforms with PubNub
23pubnub-scale
Scale PubNub applications for high-volume real-time events
22