Create, configure, and deploy PubNub Functions 2.0 event handlers, triggers, and serverless endpoints. Use when building real-time message transformations, PubNub modules, webhook integrations, or edge data processing.
Does it follow best practices?
Evaluation — 98%
↑ 1.81xAgent success when using this tile
Validation for skill structure
Our platform needs a PubNub Function that acts as a security gateway for messages on our secure API channels. Every incoming message carries a JWT token that must be verified before the message is allowed through. After verification, the function should enforce per-user rate limiting: free-tier users are allowed 100 messages per hour, while pro-tier users get 1000 messages per hour. The user's tier is encoded in the JWT payload.
When rate-limited, the message should be blocked. When authenticated and under the limit, the function should strip the raw token from the message, attach the decoded user identity, and let the message proceed. The JWT signing secret must be securely managed -- it cannot appear anywhere in the code.
The function should run on all channels under the secure.api namespace (e.g., secure.api.v1, secure.api.v2).
Produce the following files:
auth-gateway.js -- The complete PubNub Function source code.deployment.md -- Deployment guide covering trigger type, channel pattern, how to configure the JWT secret, and any pre-production steps.