A flow.completed payload's submission is Record<string, unknown> — WhatsApp
delivers everything as strings/arrays/objects and validation happened server-side,
but the static type can't know each field's shape. These helpers coerce a single
value safely (returning undefined when absent or unparseable), and
coerceSubmission applies a field-type map across a whole submission.
Parameters
value: unknown
Returns undefined|string
Example
constbudget = asNumber(event.payload.submission.budget); // number | undefined constwhen = asDate(event.payload.submission.preferred_date); // Date | undefined
Coercion helpers for flow submission values.
A
flow.completedpayload'ssubmissionisRecord<string, unknown>— WhatsApp delivers everything as strings/arrays/objects and validation happened server-side, but the static type can't know each field's shape. These helpers coerce a single value safely (returningundefinedwhen absent or unparseable), and coerceSubmission applies a field-type map across a whole submission.