Skip to main content

Webhook Object Properties

webhook.method

webhook.method: string
The HTTP method of the request (GET, POST, PUT, DELETE, etc.).

webhook.url

webhook.url: string
The full URL of the webhook request.

webhook.headers

webhook.headers: Record<string, string>
Request headers as key-value pairs. Header names are lowercase. Example:
const apiKey = webhook.headers["x-api-key"];
const contentType = webhook.headers["content-type"];

webhook.query

webhook.query: Record<string, string>
URL query parameters as key-value pairs. Example:
// URL: https://api.orangeslice.ai/webhook/abc?source=facebook
const source = webhook.query.source;  // "facebook"

webhook.body

webhook.body: any
The parsed request body. Type depends on Content-Type:
  • application/json - JavaScript object
  • application/x-www-form-urlencoded - Key-value pairs
  • text/plain - String
Example:
const email = webhook.body.email;
const name = webhook.body.name;

webhook.receivedAt

webhook.receivedAt: number
Unix timestamp (milliseconds) when the webhook was received. Example:
const date = new Date(webhook.receivedAt);
const iso = date.toISOString();

webhook.ip

webhook.ip?: string
The IP address of the requester (optional).

webhook.colId

webhook.colId: string
The unique identifier (UUID) of the webhook column.

Methods

webhook.addRootFieldsToSheet()

Automatically maps webhook body fields to sheet columns and creates a new row.
webhook.addRootFieldsToSheet(sheetName: string, create?: boolean): void
Parameters:
ParameterTypeRequiredDescription
sheetNamestringYesName of the sheet to add the row to
createbooleanNoIf true, creates columns that don’t exist. Default: false
Example:
// Webhook receives: { "name": "John", "email": "[email protected]" }

// Add to Leads sheet, creating new columns if needed
webhook.addRootFieldsToSheet("Leads", true);
Notes:
  • Only processes root-level fields (nested objects are not flattened)
  • Column names must match the keys in webhook.body
  • If create is false and a field doesn’t have a matching column, it’s ignored

Context Availability

✅ Available in Webhooks

  • webhook - Webhook object with request data
  • ctx.sheet() - Add rows to any sheet
  • ctx.getRowByValue() - Query existing rows
  • ctx.getRowById() - Get row by ID
  • ctx.utils - Utility functions
  • services - All enrichment services

❌ Not Available in Webhooks

  • ctx.thisRow - No current row context
  • ctx.thisCell - No current cell context

Type Definition

interface Webhook {
   colId: string;
   method: string;
   url: string;
   headers: Record<string, string>;
   query: Record<string, string>;
   body: any;
   receivedAt: number;
   ip?: string;
   
   addRootFieldsToSheet(sheetName: string, create?: boolean): void;
}