Skip to navigation

webhookExpressions

View as MarkdownOpen in Claude

Add expressions that run after the most recently added webhook completes. Allows conditional output based on the API response.

Parameters

expressions
Record<string, unknown>[]Required

List of expression definitions to evaluate against the webhook response.

Returns

DataMap — Self for method chaining. Throws an Error if no webhook has been added yet.

Example

import { DataMap, FunctionResult } from '@signalwire/sdk';
const dm = new DataMap('check_status');
dm.webhook('GET', 'https://api.example.com/status');
dm.webhookExpressions([
{
string: '${response.status}',
pattern: 'active',
output: new FunctionResult('The account is active.').toDict(),
},
]);