ctx object is the second parameter of every handler. It contains info about the company, bot, user, trigger type, and provides access to secrets, messaging, memory, and logging.
Reference
| Property | Type | Description |
|---|---|---|
ctx.functionSlug | string | Function slug |
ctx.company | { id, name } | Company of the request |
ctx.bot | { id, name, channel } | Bot that originated the request |
ctx.user | { id, names?, roomId? } | Conversation user |
ctx.conversation | { id?, ... } | Conversation data |
ctx.operator | { id?, ... } | Assigned operator |
ctx.trigger | TriggerInfo | Trigger type (http, cron, event) |
ctx.env | EnvAccessor | Access to secrets |
ctx.params | Record<string, string> | Route parameters |
ctx.query | Record<string, string> | Query string params |
ctx.jelou | JelouSDK | WhatsApp messaging client |
ctx.memory | MemorySDK | Key-value session memory |
ctx.method | string | HTTP method (GET, POST, etc.) |
ctx.path | string | Request path |
ctx.requestId | string | Unique request UUID |
ctx.isCron | boolean | true if cron trigger |
ctx.isEvent | boolean | true if event trigger |
ctx.isHttp | boolean | true if HTTP request |
ctx.skillId | string | null | Brain Studio skill ID |
ctx.executionId | string | null | Brain Studio execution ID |
ctx.log() | (...args) => void | Structured logger |
Identity
Trigger
- HTTP
- Cron
- Event
Request
Environment (secrets)
Internal variables with
__FN_ prefix are blocked — ctx.env.get("__FN_COMPANY_ID") returns undefined.Messaging (ctx.jelou)
Messaging guide
14 message types, HSM templates, and error handling.
Memory (ctx.memory)
Memory guide
Primitives, JSON, TTL, limits, and common patterns.
Logging
ctx.log() writes structured JSON with automatic metadata:
Messaging
Send WhatsApp with ctx.jelou.
Memory
Persist data with ctx.memory.
Secrets
Encrypted environment variables.
Authentication
Runtime tokens and public functions.