diff --git a/components/vapi/actions/create-call/create-call.mjs b/components/vapi/actions/create-call/create-call.mjs index 04305348067e1..84fcb5b658b0e 100644 --- a/components/vapi/actions/create-call/create-call.mjs +++ b/components/vapi/actions/create-call/create-call.mjs @@ -5,7 +5,7 @@ export default { key: "vapi-create-call", name: "Create Call", description: "Starts a new conversation with an assistant. [See the documentation](https://docs.vapi.ai/api-reference/calls/create)", - version: "0.1.0", + version: "0.1.1", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/vapi/actions/list-assistant-id-options/list-assistant-id-options.mjs b/components/vapi/actions/list-assistant-id-options/list-assistant-id-options.mjs index f88656782eed5..f02f91017def3 100644 --- a/components/vapi/actions/list-assistant-id-options/list-assistant-id-options.mjs +++ b/components/vapi/actions/list-assistant-id-options/list-assistant-id-options.mjs @@ -3,8 +3,8 @@ import vapi from "../../vapi.app.mjs"; export default { key: "vapi-list-assistant-id-options", name: "List Assistant ID Options", - description: "Retrieves available options for the Assistant ID field.", - version: "0.0.2", + description: "Retrieves available options for the Assistant ID field. [See the documentation](https://docs.vapi.ai/api-reference/assistants/list)", + version: "0.0.3", type: "action", annotations: { destructiveHint: false, @@ -13,14 +13,27 @@ export default { }, props: { vapi, + createdAtLt: { + type: "string", + label: "Created At (Less Than)", + description: "The timestamp to filter assistants by creation date (less than). Example: `2026-01-01T00:00:00Z`", + optional: true, + }, }, async run({ $ }) { - const options = await vapi.propDefinitions.assistantId.options.call(this.vapi, {}); - $.export("$summary", `Successfully retrieved ${options.length} option${ - options.length === 1 - ? "" - : "s" - }`); - return options; + const { + options, context, + } = await vapi.propDefinitions.assistantId.options.call(this.vapi, { + prevContext: { + createdAtLt: this.createdAtLt, + }, + }); + $.export("$summary", `Successfully retrieved ${options?.length ?? 0} option${options?.length === 1 + ? "" + : "s"}`); + return { + options, + context, + }; }, }; diff --git a/components/vapi/actions/list-phone-number-id-options/list-phone-number-id-options.mjs b/components/vapi/actions/list-phone-number-id-options/list-phone-number-id-options.mjs index 5eaa11c35a6d0..cb5aa0a814c84 100644 --- a/components/vapi/actions/list-phone-number-id-options/list-phone-number-id-options.mjs +++ b/components/vapi/actions/list-phone-number-id-options/list-phone-number-id-options.mjs @@ -3,8 +3,8 @@ import vapi from "../../vapi.app.mjs"; export default { key: "vapi-list-phone-number-id-options", name: "List Phone Number ID Options", - description: "Retrieves available options for the Phone Number ID field.", - version: "0.0.2", + description: "Retrieves available options for the Phone Number ID field. [See the documentation](https://docs.vapi.ai/api-reference/phone-numbers/list)", + version: "0.0.3", type: "action", annotations: { destructiveHint: false, @@ -13,12 +13,27 @@ export default { }, props: { vapi, + createdAtLt: { + type: "string", + label: "Created At (Less Than)", + description: "The timestamp to filter phone numbers by creation date (less than). Example: `2026-01-01T00:00:00Z`", + optional: true, + }, }, async run({ $ }) { - const options = await vapi.propDefinitions.phoneNumberId.options.call(this.vapi); - $.export("$summary", `Successfully retrieved ${options.length} option${options.length === 1 + const { + options, context, + } = await vapi.propDefinitions.phoneNumberId.options.call(this.vapi, { + prevContext: { + createdAtLt: this.createdAtLt, + }, + }); + $.export("$summary", `Successfully retrieved ${options?.length ?? 0} option${options?.length === 1 ? "" : "s"}`); - return options; + return { + options, + context, + }; }, }; diff --git a/components/vapi/actions/list-squad-id-options/list-squad-id-options.mjs b/components/vapi/actions/list-squad-id-options/list-squad-id-options.mjs index 2eccd046d5bfe..6be07c1f81e17 100644 --- a/components/vapi/actions/list-squad-id-options/list-squad-id-options.mjs +++ b/components/vapi/actions/list-squad-id-options/list-squad-id-options.mjs @@ -3,8 +3,8 @@ import vapi from "../../vapi.app.mjs"; export default { key: "vapi-list-squad-id-options", name: "List Squad ID Options", - description: "Retrieves available options for the Squad ID field.", - version: "0.0.2", + description: "Retrieves available options for the Squad ID field. [See the documentation](https://docs.vapi.ai/api-reference/squads/list)", + version: "0.0.3", type: "action", annotations: { destructiveHint: false, @@ -13,12 +13,27 @@ export default { }, props: { vapi, + createdAtLt: { + type: "string", + label: "Created At (Less Than)", + description: "The timestamp to filter squads by creation date (less than). Example: `2026-01-01T00:00:00Z`", + optional: true, + }, }, async run({ $ }) { - const options = await vapi.propDefinitions.squadId.options.call(this.vapi); - $.export("$summary", `Successfully retrieved ${options.length} option${options.length === 1 + const { + options, context, + } = await vapi.propDefinitions.squadId.options.call(this.vapi, { + prevContext: { + createdAtLt: this.createdAtLt, + }, + }); + $.export("$summary", `Successfully retrieved ${options?.length ?? 0} option${options?.length === 1 ? "" : "s"}`); - return options; + return { + options, + context, + }; }, }; diff --git a/components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs b/components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs index fd485a3dbf429..021f2fc60e1ab 100644 --- a/components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs +++ b/components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs @@ -14,7 +14,7 @@ export default { key: "vapi-update-assistant-settings", name: "Update Assistant Settings", description: "Updates the configuration settings for a specific assistant. [See the documentation](https://docs.vapi.ai/api-reference/assistants/update)", - version: "0.0.3", + version: "0.0.4", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/vapi/actions/upload-file/upload-file.mjs b/components/vapi/actions/upload-file/upload-file.mjs index 49ace319d61b1..896151cd1a38f 100644 --- a/components/vapi/actions/upload-file/upload-file.mjs +++ b/components/vapi/actions/upload-file/upload-file.mjs @@ -6,7 +6,7 @@ export default { key: "vapi-upload-file", name: "Upload File", description: "Uploads a new file. [See the documentation](https://docs.vapi.ai/api-reference)", - version: "0.0.6", + version: "0.0.7", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/vapi/package.json b/components/vapi/package.json index 136d8de6d36bc..ca170e6618c82 100644 --- a/components/vapi/package.json +++ b/components/vapi/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/vapi", - "version": "0.4.0", + "version": "0.4.1", "description": "Pipedream Vapi Components", "main": "vapi.app.mjs", "keywords": [ diff --git a/components/vapi/sources/new-conversation/new-conversation.mjs b/components/vapi/sources/new-conversation/new-conversation.mjs index 0ff34232daf3e..322c6ac840045 100644 --- a/components/vapi/sources/new-conversation/new-conversation.mjs +++ b/components/vapi/sources/new-conversation/new-conversation.mjs @@ -6,7 +6,7 @@ export default { key: "vapi-new-conversation", name: "New Conversation Started", description: "Emit new event when a voicebot starts a conversation.", - version: "0.0.2", + version: "0.0.3", type: "source", dedupe: "unique", methods: { diff --git a/components/vapi/vapi.app.mjs b/components/vapi/vapi.app.mjs index e576ad73a4034..2178d8035235e 100644 --- a/components/vapi/vapi.app.mjs +++ b/components/vapi/vapi.app.mjs @@ -9,60 +9,77 @@ export default { type: "string", label: "Assistant ID", description: "ID of the assistant to start a conversation with or update", - async options() { - const assistants = await this.listAssistants({ - params: { - limit: LIMIT, - }, + async options({ prevContext }) { + return this._paginatedOptions({ + fetchFn: (opts) => this.listAssistants(opts), + prevContext, + mapFn: ({ + id: value, name: label, + }) => ({ + label, + value, + }), }); - return assistants.map(({ - id: value, name: label, - }) => ({ - label, - value, - })); }, }, squadId: { type: "string", label: "Squad ID", description: "ID of the squad to assign to the conversation", - async options() { - const squads = await this.listSquads({ - params: { - limit: LIMIT, - }, + async options({ prevContext }) { + return this._paginatedOptions({ + fetchFn: (opts) => this.listSquads(opts), + prevContext, + mapFn: ({ + id: value, name: label, + }) => ({ + label, + value, + }), }); - return squads.map(({ - id: value, name: label, - }) => ({ - label, - value, - })); }, }, phoneNumberId: { type: "string", label: "Phone Number ID", description: "ID of the phone number to use for the conversation", - async options() { - const phoneNumbers = await this.listPhoneNumbers({ - params: { - limit: LIMIT, - }, + async options({ prevContext }) { + return this._paginatedOptions({ + fetchFn: (opts) => this.listPhoneNumbers(opts), + prevContext, + mapFn: ({ + id: value, name, number, + }) => ({ + label: (name && number) + ? `${name} (${number})` + : (name ?? number ?? value), + value, + }), }); - return phoneNumbers.map(({ - id: value, name, number, - }) => ({ - label: (name && number) - ? `${name} (${number})` - : (name ?? number ?? value), - value, - })); }, }, }, methods: { + async _paginatedOptions({ + fetchFn, prevContext, mapFn, + }) { + const params = { + limit: LIMIT, + createdAtLt: prevContext?.createdAtLt, + }; + const items = await fetchFn({ + params, + }); + const lastItem = items[items.length - 1]; + return { + options: items.map(mapFn), + context: { + createdAtLt: items.length === LIMIT + ? lastItem?.createdAt + : undefined, + }, + }; + }, _baseUrl() { return "https://api.vapi.ai"; },