ctx, where you can inspect and transform it, update the lead, call any external HTTP API, and return a result for the run history.
Use a Cloud Function when an integration needs custom logic, not just a copy of an event. For example, you can reshape a qualified lead for your CRM, notify a team only for high-value conversions, or send meeting data to your own backend without hosting a separate event handler.
Cloud Functions are available under Advanced → Cloud Functions. Each function listens to one trigger, and the trigger determines the shape of
ctx.How it works
- An event occurs in Nexor, such as a lead changing status.
- Nexor invokes the active Cloud Functions mapped to that trigger.
- The function receives the trigger-specific event object as
ctxand runs in a sandboxed JavaScript environment. - Nexor stores its console output, HTTP requests, return value, lead changes, status, and duration in the run history.
ctx fields and return early when they do not match. Nexor dispatches at most 25 matching active functions per event; if more are active, the excess functions are skipped.
Cloud Functions are intended for short event handlers. Each execution has an 8-second timeout.
Create a function
Only organization admins can create, edit, manually run, pause, or delete Cloud Functions. Other users can view functions, run history, and environment-variable names.
1
Name the function and choose a trigger
Go to Advanced → Cloud Functions, click New function, enter a descriptive name, and select the event that should run your code.
2
Inspect the payload
Open the Payload tab in the editor. It shows a sample
ctx for the selected trigger, including example values. Click a field to insert it into your code, and handle fields that may be null or absent in a live event.3
Write the integration logic
Use the event data, the built-in lead helpers, and
axios or fetch to implement the action. Add API keys, tokens, and endpoint URLs as environment variables instead of placing secrets in the code.4
Save and test
Save to deploy the function, then click Run to execute the deployed version with an editable sample
ctx. Review the output, network calls, return value, and proposed lead changes.5
Activate and monitor
Keep Active enabled to run the function automatically. Open Logs to inspect later executions, or pause the function without deleting its code.
The trigger cannot be changed after the function is created because it defines the event subscription and payload. Create a new function if you need to react to a different event.
Available triggers
Each function maps to one of the following 23 events.Leads
Information
Conversations
Conversions
Meetings
Tasks and agent runs
Work with the event object
The shape ofctx depends on the trigger. It can contain top-level identifiers and event fields as well as nested objects such as lead, statuses, changes, metadata, attendees, or a task payload. Common fields include lead_id, client_id, workflow_id, and timestamps, but fields can be null or absent depending on how the event occurred.
Use the Payload tab to explore the sample object, then inspect Input · ctx in the run output or logs to see the payload received by a specific execution. Guard optional fields in production code instead of assuming every sample field is present.
The function can use the following values, helpers, and language features. The runtime built-ins require no imports.
updateLead and updateMetadata change the sandbox’s lead copy and buffer the corresponding effects. Nexor applies them only after a successful automatic execution. They are not applied when the function throws, times out, or runs manually from the editor.
Send an event out of Nexor
This example mapslead.status_changed to a CRM endpoint. It filters for the qualified status, creates the external payload from ctx, sends it with a secret token, and records the successful sync on the Nexor lead.
Environment variables
Admins manage organization-level variables from the Environment variables section on the Cloud Functions page. Other users can see variable names but not their values. Read a variable in code asenv.NAME, for example env.CRM_API_TOKEN.
Environment-variable values are write-only in the dashboard: a function can read them at runtime, but the UI cannot reveal them after they are saved. Creating, replacing, or deleting a variable redeploys every saved Cloud Function in the organization.
An organization can store up to 128 variables. Names must start with an uppercase letter and contain only uppercase letters, numbers, or underscores, with a maximum of 64 characters. Each non-empty value can contain up to 5 KiB.
Review executions
The editor output and Logs page help you follow each execution. A run includes:- its origin and trigger;
- success, error, or timeout status;
- duration and timestamp;
- the input
ctx; - console output and uncaught errors;
- redacted HTTP request and response previews, with body previews capped at 16 KiB;
- the returned result; and
- lead and metadata effects produced by the function.
Cloud Functions or webhooks?
Use a Cloud Function when the event needs code: filtering, transformation, branching, calls to multiple systems, or a write back to the Nexor lead. Use a webhook when you only need Nexor to deliver a signed event to an endpoint you already operate. Cloud Functions and webhooks use different event names and payload contracts. For example, the Cloud Function trigger islead.status_changed, while the related webhook event is workflow_run.status_changed. Do not parse ctx as a webhook envelope.