Read a number’s call flow
Get a number’s call flow returns the flow and anETag header that identifies this state of the flow’s steps. Every live write needs it; a draft save may omit it. A shortened answer:
include=namesadds a name next to each id, such asgroupName.- To poll, send the
ETagasIf-None-Match: an unchanged flow answers304. TheETagcovers the steps only, sobusinessHours,versionId,editableandproblemscan change while it stays the same. - HTTP Request header values are never returned: a header reads
value: nullwithvalueSet: true.
When a flow is not editable
A flow that readseditable: false cannot be sent back as it is. problems says why:
When contact fields cannot be read, a custom field variable in an HTTP Request step may read in its stored id form,
{{contact.custom_fields.<id>}}. It is accepted back as it is.
editable: true does not promise that an unchanged save succeeds: a flow saved in the Dashboard may break a limit (422 VALIDATION.INVALID_FIELD) or lack ringSeconds on a ring or redirect step with steps under “no answer” (422 CALL_FLOWS.RING_SECONDS_REQUIRED).
Change a number’s call flow
Replace a number’s call flow replaces every step. Send the document you read with your change, and theETag of your read as If-Match. This flow plays a greeting, rings the Support group, then takes a voicemail:
ETag, versionId and warnings.
- Ids. Keep a step by sending its
id; a step without one is new, and steps you leave out are deleted. Give a new step arefwhen another step points at it, such as a Jump totarget. - Round trip. A document you read is accepted back, except for a flow that is not editable. Read-only fields are ignored; any other unknown field is
400 VALIDATION.INVALID_BODY. - Secrets. Send an HTTP Request header without
valueto keep its stored value. Put credentials in headers, not in the URL or body. - Other numbers. Deleting a step also deletes the Jump to steps in other numbers that point at it.
ETag is a hash of the stored steps. A change to them moves it, such as a Dashboard save or deleting a group the flow uses; a change that returns them to your read, such as a restore, brings it back. On a 412, read the flow again, apply your change and retry.
After a
500 on a call flow write, read the flow before you retry. Do not retry with the same If-Match: if a later edit returned the steps to the content of your read, the retry would overwrite that edit. A retried draft save may store a second draft.
Step types
List call flow step types gives the 18 step types the API writes, each with its fields as JSON Schema and whether your plan allows it.- Fax must be the only step of the flow.
- After Voicemail, only HTTP Request, Mark Call as Resolved, Condition Splitter, Day/Time Splitter and Jump to may follow.
- Jump to may loop back when the loop has a step that waits for the caller, such as an IVR menu or a ring step.
- Day/Time Splitter times are in the account time zone. With no match and no
otherwise, the call is hung up.
Limits
- Size limits. A call flow has at most 200 steps and a body of at most 1 MiB (
413 VALIDATION.INVALID_BODY). A stepnametakes up to 100 characters, a Collect Inputpatternup to 255. An HTTP Request step takes aurlup to 2,048 characters, up to 50 headers (name up to 256 characters, value up to 8,192) and up to 50 body fields (key up to 255 characters, value up to 8,192). A Condition Splitter takes up to 50 branches of up to 50 conditions, a Day/Time Splitter up to 50 branches. A step over 64 KB, or a field over its limit, is422 VALIDATION.INVALID_FIELDat that step or field. The Dashboard does not enforce these limits.
Check a change before you save it
Validate a call flow runs every check of a save without saving, and answers200 even when the document has errors:
errorslists what a save would refuse, including a staleIf-MatchasCALL_FLOWS.ETAG_MISMATCH.warningsnever stop a save.BUSINESS_HOURS_APPLYmeans business hours run before the flow.changespreviews the steps a save adds, updates and removes.- With
VOICE_AGENT_CHECK_SKIPPEDinwarnings, voice agents were not checked, so a save may still answer502.
Save a draft and publish it
Save with?draft=true to keep a change for a person to approve. Calls keep using the live flow. The draft passes every check of a save, and the response is 201 with live: false and the draft’s versionId.
If-Match is optional for a draft. Send the ETag of your read and keep it for the publish: the draft’s own etag is the live flow’s, which may be newer.
Publish a call flow draft by the draft’s versionId, with the ETag of your read. Avoid latest-draft: it names the newest draft when the request arrives, which may not be the approved one.
412 whatever ETag you send: read the live flow, save the draft again on it, and publish the new draft. A number keeps up to 10 drafts, oldest dropped first. A draft over 15 MiB is refused with 422.
Publishing a version that is not a draft is 409 CALL_FLOWS.NOT_A_DRAFT.
Undo a change
Restore a call flow version makes a version live again, with the checks of a save:actor), from where (source) and why (note). Besides an id, restore takes live, latest and latest-draft.
- Every save keeps a version, from the Dashboard or the API. A number keeps its latest 50 versions and up to 10 drafts. The
baselineis always kept: the flow as it was before versions were introduced. - When a number is released, its versions are deleted with it. A number whose flow you delete keeps its versions.
- A save whose version would be over 15 MiB keeps no version. Deleting a user or group in the Dashboard, a plan downgrade and a new number’s default step write none either.
id; the others come back as new steps. Jump to steps that a change deleted in other numbers do not come back (warning JUMP_TO_NOT_RESTORED).
Header values. Versions keep HTTP Request header values only for a while. Drafts always keep them. Any other version keeps them while it is one of the number’s 5 newest versions (drafts not counted) or less than 7 days old; after that, the next save of the flow removes them. A restore fills a missing value from the live step with the same id and header name. When the live flow has none, the restore is 422 CALL_FLOWS.HEADER_VALUE_REQUIRED and changes nothing: read the version, set those header values in its steps, and save it with Replace a number’s call flow. A step the live flow no longer has goes without its id, as a new step.
Delete a number’s call flow
Delete a number’s call flow removes every step (sendIf-Match). From the next call, calls to the number are hung up straight away; business hours still apply. Jump to steps in other numbers that pointed into the flow are deleted. The number keeps its versions, so a restore undoes the deletion.
Set business hours
Outside business hours, a call gets the closed action instead of the call flow. A flow’sbusinessHours shows whether hours apply and whose.
- Company business hours apply to every number that uses them, while
enabledistrue. - A number’s own business hours apply instead while
useOwnHoursistrue. SenduseOwnHours: falsealone to return to the company hours; the number’s own hours are kept.
- Times are
HH:mmin the account time zone. A special date overrides the weekday and holidays: closed all day, or open fromfromtoto.holidaysClosedcloses on the public holidays of the number’s country (List public holidays). closedActionisredirect,voicemail,soundorsoundThenVoicemail. A replace that sets hours, such as one withuseOwnHours: true, needs one.- A replace takes up to 100 opening intervals and 1,000 special dates, and applies to the next call. Business hours keep no versions.
- Hours never saved read with empty lists and
closedAction: null, and are accepted back as they are. - A closed action whose
soundId,voicemailBoxIdorphoneNumberreadsnullis accepted back only with the hours off (enabled: falseoruseOwnHours: false) and withopeningHours,specialDates,holidaysClosedandclosedActionas a read returns them now. The hours then switch off and the stored closed action is kept. Otherwise thenullis422 VALIDATION.INVALID_FIELD.
Redirect all calls in an emergency
- Read the number’s hours with Get a number’s business hours and keep the object: it is your way back.
- Replace them as in the example above: today as a special date with
closedAllDay: true, and aredirectclosed action. - When it is over, send the object you kept, as it is, even for hours never saved (
useOwnHours: false,closedAction: null). If the keptclosedActionhassoundId,voicemailBoxIdorphoneNumbernull, set a value in it first: your emergency change replaced the stored hours, and withuseOwnHours: truea save always needs a value.
Add a sound
Steps and closed actions play sounds. Create a sound from text, with a voice from List text-to-speech voices, or from an MP3 file up to 8 MB:status: processing, then turns ready, or failed when it cannot be converted: check status with Get a sound. A flow may use it at once (validate warns SOUND_PROCESSING). Its audioUrl expires after about 5 minutes. A retry with the same Idempotency-Key and body returns the first answer for 24 hours.
List voicemail boxes gives the
voicemailBoxId values.
Errors
- An unknown number id is
404 CALL_FLOWS.NUMBER_NOT_FOUND(BUSINESS_HOURS.NUMBER_NOT_FOUNDon business hours). 403means your plan lacks a feature:BUSINESS_HOURS.NOT_IN_PLAN,BUSINESS_HOURS.VOICEMAIL_NOT_IN_PLAN(a voicemail closed action on a plan without human agents),SOUNDS.NOT_IN_PLAN,CALL_FLOWS.STEP_TYPE_NOT_IN_PLAN.- The call flow operations answer
403 FORBIDDENwhen your account is not active, and409 CALL_FLOWS.NUMBER_NOT_READYwhen the number has no routing record: contact support. - List voicemail boxes answers
504 TIMEOUTafter 30 seconds. Retry. - When you contact support, quote
requestId, which is the request’sX-Request-ID.
401, 429 and 500.