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

1import { DataMap, FunctionResult } from '@signalwire/sdk';
2
3const dm = new DataMap('check_status');
4dm.webhook('GET', 'https://api.example.com/status');
5dm.webhookExpressions([
6 {
7 string: '${response.status}',
8 pattern: 'active',
9 output: new FunctionResult('The account is active.').toDict(),
10 },
11]);