transfer
Hand processing over to another section, another SWML document fetched from a URL, or an inline
SWML document. This is a tail call: it does not return, and steps after transfer, including
steps in calling sections, are skipped. A URL or inline destination also replaces the current
document.
Properties
transfer
An object that accepts the following properties.
transfer.dest
Where to transfer. Accepts any valid destination. %{...} variable
references in dest are expanded before the destination is resolved.
transfer.method
HTTP method for the fetch request. One of GET, POST, PUT, PATCH, or DELETE. Used only
when dest is a URL.
transfer.params
Parameters for the transferred section or document, available there as params.*. When dest
is a URL, they are also sent in the request body. They replace the current params rather than
merging with them; when omitted, the target receives an empty object.
String values are expanded for %{...} variable references at every depth, including inside
nested objects and arrays. Keys are not expanded. Each substitution produces a string, a
reference to a path that doesn’t exist becomes an empty string, and expressions are not
evaluated.
Valid destinations
transfer.dest takes one of three forms:
- Section name — the name of a section in the current document, such as
support. The section runs with the document’s current variables. - URL — an
httporhttpsURL that returns a messaging SWML document. SignalWire fetches it withmethodand sends the inbound message webhook payload described below in the request body. Authentication can be set in the URL in the formatusername:password@url. - Inline document — a complete messaging SWML document, supplied as a string that holds the
document serialized as a JSON object. A YAML or JSON object nested directly under
destis not accepted, and a string that isn’t a valid JSON object is treated as a section name. Execution starts at the document’ssections.main.
Webhook payload sent to dest
When dest is a URL, SignalWire sends the
inbound message webhook payload
in the request body to dest, using method (POST by default):
message— the original inbound message that triggered this SWML document.params— the values supplied to thistransferstep.vars— runtime variables propagated from the current document (request_result,reply_result,request_response,request_response_code,request_response_body,reply_message_id). Present on transfer-driven fetches; absent on the initial inbound fetch.
Examples
Transfer to an external SWML handler
Transfer to a section with expanded params
String values inside params are expanded before the transfer, including values in nested arrays.
Transfer to an inline document
The inline document is a JSON string, so its quotes are escaped in JSON and the whole value is quoted in YAML.