mv.flowTemplates
Starter flows to create a flow from. These methods are on mv.flowTemplates, where mv is your client (see the Node.js SDK). Each one returns the response object and throws when the API answers with an error.
list()
Section titled “list()”List flow templates. The starter flows you can create a flow from (template_id on POST /v1/flows), with names and descriptions in language.
mv.flowTemplates.list(query?: NonNullable<FlowTemplatesListData["query"]>, options?: RequestOptions): PagedList<FlowTemplatesListResponse["data"][number], NonNullable<FlowTemplatesListData["query"]>>GET /flow_templates · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
query.limit |
integer |
no | How many objects to return, 1–100 (default 20). |
query.starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
query.ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
query.kind |
string |
no | Only templates of this kind. |
query.language |
string |
no | The language of names and descriptions (default en). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”A PagedList: await it for the first page, for await it for every item.
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
for await (const flowTemplate of mv.flowTemplates.list()) { console.log(flowTemplate);}retrieve()
Section titled “retrieve()”Retrieve a flow template. A starter flow with its graph in the v1 node schema, in language (default en).
mv.flowTemplates.retrieve(templateId: FlowTemplatesRetrieveData["path"]["template_id"], query?: NonNullable<FlowTemplatesRetrieveData["query"]>, options?: RequestOptions): Promise<FlowTemplatesRetrieveResponse>GET /flow_templates/{template_id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
template_id |
string |
yes | The template’s ID. |
query.language |
string |
no | The template’s language (default en): its lines, names and description. |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”FlowTemplate:
| Field | Type | Description |
|---|---|---|
template_id |
string |
The template’s ID: pass it as template_id to POST /v1/flows. |
object |
"flow_template" |
Always flow_template. |
kind |
"voice" | "agent_script" | "ivr" |
— |
language |
"en" | "he" |
— |
name |
string |
— |
description |
string |
— |
tags |
string[] |
— |
node_count |
integer |
— |
graph |
FlowGraph |
A flow’s graph: nodes (v1 node schema) wired by their transitions’ next, variables and settings. |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const flowTemplate = await mv.flowTemplates.retrieve("appointment-booking");console.log(flowTemplate);