sendFax

View as MarkdownOpen in Claude

Send a fax document on the call. The document must be accessible via URL. Returns a FaxAction that you can use to stop the fax or wait for it to complete.

This method emits calling.call.fax events. See Call Events for payload details.

Parameters

document
stringRequired

URL of the document to fax (PDF or TIFF format).

identity
string | undefined

Caller identity string (TSI) transmitted with the fax.

headerInfo
string | undefined

Header text printed at the top of each fax page.

controlId
string | undefined

Custom control ID. Auto-generated if not provided.

onCompleted
(event: RelayEvent) => void | Promise<void>

Callback invoked when the fax operation completes.

Returns

Promise<FaxAction> — An action handle with stop() and wait() methods.

Example

1import { RelayClient } from '@signalwire/sdk';
2
3const client = new RelayClient({
4 project: process.env.SIGNALWIRE_PROJECT_ID!,
5 token: process.env.SIGNALWIRE_TOKEN!,
6 contexts: ['default']
7});
8
9client.onCall(async (call) => {
10 await call.answer();
11
12 const action = await call.sendFax(
13 'https://example.com/invoice.pdf',
14 { identity: '+15559876543', headerInfo: 'Invoice #12345' }
15 );
16 const event = await action.wait();
17
18 const faxResult = event.params.fax as Record<string, unknown> ?? {};
19 console.log(`Fax sent: ${faxResult.pages ?? 0} pages`);
20 await call.hangup();
21});
22
23await client.run();