Skip to navigation
Calling

send_fax

View as MarkdownOpen in Claude

Send a fax. For a live inbound call that hasn’t been answered yet, the method first attempts to answer it.

Properties

send_fax
objectRequired

An object that accepts the following properties.

send_fax.document
stringRequired

URL to the PDF document to fax

send_fax.header_info
string

Text to add to the fax header. When omitted or empty, the call’s destination address is used (the destination number for phone calls).

send_fax.identity
string

Station identity to report. When omitted, the call’s originating address is used (the calling number for phone calls).

send_fax.status_url
string

HTTP or HTTPS URL to deliver send fax status events. Learn more about status callbacks.

Variables

Set by the method:

  • send_fax_document: (out) URL of sent document.
  • send_fax_identity: (out) identity of this fax station.
  • send_fax_remote_identity: (out) identity of the receiving fax station.
  • send_fax_pages: (out) number of pages sent.
  • send_fax_result_code: (out) fax status code.
  • send_fax_result_text: (out) description of fax status code.
  • send_fax_result: (out) success | failed.

All values are stored as strings, including send_fax_pages and send_fax_result_code. Check send_fax_result first: when the fax fails, the detailed variables may not be set, and send_fax_result_text holds a failure message only when one is available.

StatusCallbacks

Status callbacks are advisory

Status callbacks are asynchronous, best-effort HTTP notifications: delivery can be delayed or fail silently — if your server is unreachable, the callback simply never arrives. Don’t gate time-critical or business-critical actions solely on receiving one. Confirm state via the REST API before acting, or use a transport with visible failure modes — see Status callback reliability.

A POST request will be sent to status_url with a JSON payload like the following, for the calling.call.fax page and finished events:

event_type
string

The type of event. calling.call.fax for the fax events described here. When the fax command fails, an error event with event type calling.error may be sent instead; see error events.

event_channel
string

The channel for the event, includes the SWML session ID.

timestamp
number

Unix timestamp (float) when the event was generated.

project_id
string

The project ID associated with the call.

space_id
string

The Space ID associated with the call.

params
object

An object containing fax-specific parameters.

params.call_id
string

The call ID.

params.node_id
string

The node handling the call.

params.control_id
string

The control ID for this fax operation.

params.fax
object

Fax result details.

params.fax.type
string

The type of fax operation. Always finished.

params.fax.params
object

Details of the fax operation.

params.fax.params.direction
string

The direction of the fax (send).

params.fax.params.identity
string

The identity of this fax station.

params.fax.params.remote_identity
string

The identity of the receiving fax station.

params.fax.params.document
string

URL of the sent fax document.

params.fax.params.pages
number

Number of pages sent.

params.fax.params.success
boolean

Whether the fax was sent successfully.

params.fax.params.result
number

The numeric result code of the fax operation (e.g., 0 for success).

params.fax.params.result_text
string

A description of the fax result (e.g., OK).

params.fax.params.format
string

The format of the fax document. Always "pdf".

Page progress events

A separate callback is sent for each page as the fax progresses:

params.fax.type
string

Always "page" for page progress events.

params.fax.params.direction
string

The direction of the fax.

params.fax.params.number
number

The page number that was just processed.

Raw JSON example

{
"event_type": "calling.call.fax",
"event_channel": "swml:xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"timestamp": 1640000000.123,
"project_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"space_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"params": {
"call_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"node_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"control_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"fax": {
"type": "finished",
"params": {
"direction": "send",
"identity": "+15551231234",
"remote_identity": "+15553214321",
"document": "https://example.com/fax_to_send.pdf",
"pages": 3,
"success": true,
"result": 0,
"result_text": "OK",
"format": "pdf"
}
}
}
}

Error events

When the fax command fails, SignalWire may send an event with event_type set to calling.error to status_url instead of a calling.call.fax event. Its params object has no fax object. It carries the call identifiers and these fields:

params.error.code
string

The error code.

params.error.message
string

A description of the error.

params.request
object

A copy of the request that failed, included for diagnostics only. Its shape isn’t a stable contract.

Check event_type before reading the rest of the payload. Not every failure produces an error event, and the outcome of the fax itself is reported in params.fax.params.success of the finished event.


Examples

Send a fax and post a result to a webhook

version: 1.0.0
sections:
main:
- send_fax:
document: https://example.com/fax_to_send.pdf
- execute:
dest: 'https://example.com/handle_outgoing_fax_result'