Modules and libraries

This page lists every built-in JavaScript module available inside a PubNub Function. For conceptual guidance on the runtime and its trigger types, see Functions. For per-execution operation caps (XHR requests, KV store operations, PubNub API calls, chain depth), see API limits.

Load a module with require(). No package installation step is needed. The Functions runtime does not support native Node.js modules, npm packages, the process global, or WebSocket connections. See Built-in modules for what the runtime supports instead.

Modulerequire() nameDescription
kvstorekvstorePersistent key-value store scoped to your subscribe key.
xhrxhrOutbound HTTP and HTTPS requests.
pubnubpubnubPubNub client SDK capabilities and Functions-specific publishing methods.
cryptocryptoHashing, HMAC, signing, and verification.
vaultvaultRead-only access to secrets stored on your keyset.
jwtjwtCreates and verifies JSON Web Tokens.
uuiduuidGenerates RFC-compliant UUIDs.
codeccodec/auth, codec/base64, codec/query_stringBasic Auth headers, Base64, and query-string encoding and decoding.
jsonpath-plusjsonpathQueries JSON documents and JavaScript objects with JSONPath expressions.
advanced_mathadvanced_mathDistance calculation and degrees-to-radians conversion.
utilsutilsRandom integer generation and numeric type checking.
ugcugcModerates user-generated content inline against an Auto Moderation configuration.
  • Functions. What each trigger type does and when to use it.
  • Function types. Per-trigger reference for every Function type.
  • Request and response objects. Every field and method on the request, response, and event objects a handler receives.
  • API limits. Per-execution operation caps, including XHR requests, KV store operations, PubNub API calls, and chain depth.

Was this page useful?

Last updated on