user_variables

View as MarkdownOpen in Claude

Return the user variables from a SWML request body. They are nested two levels down, at vars.userVariables, which is easy to get wrong silently: a missing level yields an empty dict and every downstream check quietly reports “not declared”.

Parameters

body_params
AnyRequired

The SWML request body, as passed to a dynamic-config callback or SWAIG handler.

Returns

dict[str, Any] — The user variables, or {} when absent or malformed. Never raises.

Example

from signalwire.core.capabilities import user_variables
def configure(query_params, body_params, headers, ephemeral_agent):
variables = user_variables(body_params)
nonce = variables.get("handoff_nonce")

Part of the client capabilities module.