@ikatec/digisac-api-sdk 4.14.0 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/dist/apis/absence/AbsenceApi.cjs +2 -2
- package/dist/apis/absence/AbsenceApi.cjs.map +1 -1
- package/dist/apis/absence/AbsenceApi.d.ts +2 -2
- package/dist/apis/absence/AbsenceApi.mjs +2 -2
- package/dist/apis/absence/AbsenceApi.mjs.map +1 -1
- package/dist/apis/absence/types.d.ts +1 -1
- package/dist/apis/answers/AnswersApi.cjs +23 -2
- package/dist/apis/answers/AnswersApi.cjs.map +1 -1
- package/dist/apis/answers/AnswersApi.d.ts +16 -2
- package/dist/apis/answers/AnswersApi.d.ts.map +1 -1
- package/dist/apis/answers/AnswersApi.mjs +23 -2
- package/dist/apis/answers/AnswersApi.mjs.map +1 -1
- package/dist/apis/answers/types.d.ts +1 -2
- package/dist/apis/answers/types.d.ts.map +1 -1
- package/dist/apis/authHistory/AuthHistoryApi.cjs +9 -2
- package/dist/apis/authHistory/AuthHistoryApi.cjs.map +1 -1
- package/dist/apis/authHistory/AuthHistoryApi.d.ts +7 -2
- package/dist/apis/authHistory/AuthHistoryApi.d.ts.map +1 -1
- package/dist/apis/authHistory/AuthHistoryApi.mjs +9 -2
- package/dist/apis/authHistory/AuthHistoryApi.mjs.map +1 -1
- package/dist/apis/authHistory/types.d.ts +6 -1
- package/dist/apis/authHistory/types.d.ts.map +1 -1
- package/dist/apis/bots/BotsApi.cjs +16 -7
- package/dist/apis/bots/BotsApi.cjs.map +1 -1
- package/dist/apis/bots/BotsApi.d.ts +13 -7
- package/dist/apis/bots/BotsApi.d.ts.map +1 -1
- package/dist/apis/bots/BotsApi.mjs +16 -7
- package/dist/apis/bots/BotsApi.mjs.map +1 -1
- package/dist/apis/bots/types.d.ts +12 -2
- package/dist/apis/bots/types.d.ts.map +1 -1
- package/dist/apis/campaigns/CampaignsApi.cjs +25 -1
- package/dist/apis/campaigns/CampaignsApi.cjs.map +1 -1
- package/dist/apis/campaigns/CampaignsApi.d.ts +16 -1
- package/dist/apis/campaigns/CampaignsApi.d.ts.map +1 -1
- package/dist/apis/campaigns/CampaignsApi.mjs +25 -1
- package/dist/apis/campaigns/CampaignsApi.mjs.map +1 -1
- package/dist/apis/campaigns/types.d.ts +98 -6
- package/dist/apis/campaigns/types.d.ts.map +1 -1
- package/dist/apis/cards/types.d.ts +5 -5
- package/dist/apis/categories/CategoriesApi.cjs +1 -2
- package/dist/apis/categories/CategoriesApi.cjs.map +1 -1
- package/dist/apis/categories/CategoriesApi.d.ts +1 -2
- package/dist/apis/categories/CategoriesApi.d.ts.map +1 -1
- package/dist/apis/categories/CategoriesApi.mjs +1 -2
- package/dist/apis/categories/CategoriesApi.mjs.map +1 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.cjs +2 -3
- package/dist/apis/clientFeedback/ClientFeedbackApi.cjs.map +1 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.d.ts +2 -3
- package/dist/apis/clientFeedback/ClientFeedbackApi.d.ts.map +1 -1
- package/dist/apis/clientFeedback/ClientFeedbackApi.mjs +2 -3
- package/dist/apis/clientFeedback/ClientFeedbackApi.mjs.map +1 -1
- package/dist/apis/contacts/ContactsApi.cjs +20 -6
- package/dist/apis/contacts/ContactsApi.cjs.map +1 -1
- package/dist/apis/contacts/ContactsApi.d.ts +28 -4
- package/dist/apis/contacts/ContactsApi.d.ts.map +1 -1
- package/dist/apis/contacts/ContactsApi.mjs +20 -6
- package/dist/apis/contacts/ContactsApi.mjs.map +1 -1
- package/dist/apis/contacts/types.d.ts +101 -2
- package/dist/apis/contacts/types.d.ts.map +1 -1
- package/dist/apis/customFields/types.d.ts +4 -4
- package/dist/apis/dashboard/DashboardApi.cjs +3 -3
- package/dist/apis/dashboard/DashboardApi.cjs.map +1 -1
- package/dist/apis/dashboard/DashboardApi.d.ts +3 -3
- package/dist/apis/dashboard/DashboardApi.mjs +3 -3
- package/dist/apis/dashboard/DashboardApi.mjs.map +1 -1
- package/dist/apis/dashboard/types.d.ts +11 -4
- package/dist/apis/dashboard/types.d.ts.map +1 -1
- package/dist/apis/departments/DepartmentsApi.cjs +5 -5
- package/dist/apis/departments/DepartmentsApi.cjs.map +1 -1
- package/dist/apis/departments/DepartmentsApi.d.ts +5 -5
- package/dist/apis/departments/DepartmentsApi.mjs +5 -5
- package/dist/apis/departments/DepartmentsApi.mjs.map +1 -1
- package/dist/apis/departments/types.d.ts +6 -0
- package/dist/apis/departments/types.d.ts.map +1 -1
- package/dist/apis/distribution/DistributionApi.cjs +3 -4
- package/dist/apis/distribution/DistributionApi.cjs.map +1 -1
- package/dist/apis/distribution/DistributionApi.d.ts +3 -4
- package/dist/apis/distribution/DistributionApi.d.ts.map +1 -1
- package/dist/apis/distribution/DistributionApi.mjs +3 -4
- package/dist/apis/distribution/DistributionApi.mjs.map +1 -1
- package/dist/apis/files/FilesApi.cjs +13 -1
- package/dist/apis/files/FilesApi.cjs.map +1 -1
- package/dist/apis/files/FilesApi.d.ts +12 -2
- package/dist/apis/files/FilesApi.d.ts.map +1 -1
- package/dist/apis/files/FilesApi.mjs +13 -1
- package/dist/apis/files/FilesApi.mjs.map +1 -1
- package/dist/apis/files/types.d.ts +19 -1
- package/dist/apis/files/types.d.ts.map +1 -1
- package/dist/apis/kanbanCards/KanbanCardsApi.cjs +32 -0
- package/dist/apis/kanbanCards/KanbanCardsApi.cjs.map +1 -1
- package/dist/apis/kanbanCards/KanbanCardsApi.d.ts +27 -1
- package/dist/apis/kanbanCards/KanbanCardsApi.d.ts.map +1 -1
- package/dist/apis/kanbanCards/KanbanCardsApi.mjs +32 -0
- package/dist/apis/kanbanCards/KanbanCardsApi.mjs.map +1 -1
- package/dist/apis/kanbanCards/types.d.ts +1 -1
- package/dist/apis/kanbanCards/types.d.ts.map +1 -1
- package/dist/apis/kanbanColumns/KanbanColumnsApi.cjs +19 -0
- package/dist/apis/kanbanColumns/KanbanColumnsApi.cjs.map +1 -1
- package/dist/apis/kanbanColumns/KanbanColumnsApi.d.ts +16 -1
- package/dist/apis/kanbanColumns/KanbanColumnsApi.d.ts.map +1 -1
- package/dist/apis/kanbanColumns/KanbanColumnsApi.mjs +19 -0
- package/dist/apis/kanbanColumns/KanbanColumnsApi.mjs.map +1 -1
- package/dist/apis/kanbanColumns/types.d.ts +4 -0
- package/dist/apis/kanbanColumns/types.d.ts.map +1 -1
- package/dist/apis/messages/MessagesApi.cjs +13 -4
- package/dist/apis/messages/MessagesApi.cjs.map +1 -1
- package/dist/apis/messages/MessagesApi.d.ts +13 -4
- package/dist/apis/messages/MessagesApi.d.ts.map +1 -1
- package/dist/apis/messages/MessagesApi.mjs +13 -4
- package/dist/apis/messages/MessagesApi.mjs.map +1 -1
- package/dist/apis/messages/types.d.ts +5 -0
- package/dist/apis/messages/types.d.ts.map +1 -1
- package/dist/apis/pipeline/types.d.ts +7 -8
- package/dist/apis/pipeline/types.d.ts.map +1 -1
- package/dist/apis/quickReplies/types.d.ts +4 -1
- package/dist/apis/quickReplies/types.d.ts.map +1 -1
- package/dist/apis/schedule/types.d.ts +41 -10
- package/dist/apis/schedule/types.d.ts.map +1 -1
- package/dist/apis/terms/TermsApi.cjs +2 -2
- package/dist/apis/terms/TermsApi.cjs.map +1 -1
- package/dist/apis/terms/TermsApi.d.ts +2 -2
- package/dist/apis/terms/TermsApi.mjs +2 -2
- package/dist/apis/terms/TermsApi.mjs.map +1 -1
- package/dist/apis/tickets/TicketsApi.cjs +18 -8
- package/dist/apis/tickets/TicketsApi.cjs.map +1 -1
- package/dist/apis/tickets/TicketsApi.d.ts +15 -8
- package/dist/apis/tickets/TicketsApi.d.ts.map +1 -1
- package/dist/apis/tickets/TicketsApi.mjs +18 -8
- package/dist/apis/tickets/TicketsApi.mjs.map +1 -1
- package/dist/apis/tickets/types.d.ts +4 -1
- package/dist/apis/tickets/types.d.ts.map +1 -1
- package/dist/apis/timetable/TimetableApi.cjs +6 -0
- package/dist/apis/timetable/TimetableApi.cjs.map +1 -1
- package/dist/apis/timetable/TimetableApi.d.ts +6 -0
- package/dist/apis/timetable/TimetableApi.d.ts.map +1 -1
- package/dist/apis/timetable/TimetableApi.mjs +6 -0
- package/dist/apis/timetable/TimetableApi.mjs.map +1 -1
- package/dist/apis/timetable/types.d.ts +8 -0
- package/dist/apis/timetable/types.d.ts.map +1 -1
- package/dist/apis/users/UsersApi.cjs +11 -3
- package/dist/apis/users/UsersApi.cjs.map +1 -1
- package/dist/apis/users/UsersApi.d.ts +10 -4
- package/dist/apis/users/UsersApi.d.ts.map +1 -1
- package/dist/apis/users/UsersApi.mjs +11 -3
- package/dist/apis/users/UsersApi.mjs.map +1 -1
- package/dist/apis/users/types.d.ts +26 -0
- package/dist/apis/users/types.d.ts.map +1 -1
- package/dist/apis/webhooks/types.d.ts +51 -6
- package/dist/apis/webhooks/types.d.ts.map +1 -1
- package/dist/core/BaseReadApi.cjs +2 -2
- package/dist/core/BaseReadApi.cjs.map +1 -1
- package/dist/core/BaseReadApi.d.ts +2 -2
- package/dist/core/BaseReadApi.mjs +2 -2
- package/dist/core/BaseReadApi.mjs.map +1 -1
- package/dist/core/errors.cjs +4 -1
- package/dist/core/errors.cjs.map +1 -1
- package/dist/core/errors.d.ts +4 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.mjs +4 -1
- package/dist/core/errors.mjs.map +1 -1
- package/package.json +1 -1
- package/src/apis/absence/AbsenceApi.ts +2 -2
- package/src/apis/absence/types.ts +1 -1
- package/src/apis/answers/AnswersApi.test.ts +32 -0
- package/src/apis/answers/AnswersApi.ts +38 -2
- package/src/apis/answers/types.ts +1 -2
- package/src/apis/authHistory/AuthHistoryApi.test.ts +16 -0
- package/src/apis/authHistory/AuthHistoryApi.ts +10 -2
- package/src/apis/authHistory/types.ts +6 -1
- package/src/apis/bots/BotsApi.test.ts +16 -0
- package/src/apis/bots/BotsApi.ts +25 -7
- package/src/apis/bots/types.ts +12 -2
- package/src/apis/campaigns/CampaignsApi.test.ts +48 -0
- package/src/apis/campaigns/CampaignsApi.ts +31 -2
- package/src/apis/campaigns/types.ts +101 -3
- package/src/apis/cards/types.ts +5 -5
- package/src/apis/categories/CategoriesApi.ts +1 -2
- package/src/apis/clientFeedback/ClientFeedbackApi.ts +2 -3
- package/src/apis/contacts/ContactsApi.test.ts +49 -2
- package/src/apis/contacts/ContactsApi.ts +64 -4
- package/src/apis/contacts/types.ts +111 -1
- package/src/apis/creditMovements/CreditMovementsApi.test.ts +1 -1
- package/src/apis/customFields/types.ts +4 -4
- package/src/apis/dashboard/DashboardApi.test-d.ts +9 -0
- package/src/apis/dashboard/DashboardApi.ts +3 -3
- package/src/apis/dashboard/types.ts +11 -4
- package/src/apis/departments/DepartmentsApi.ts +5 -5
- package/src/apis/departments/types.ts +13 -0
- package/src/apis/distribution/DistributionApi.ts +3 -4
- package/src/apis/files/FilesApi.test.ts +21 -0
- package/src/apis/files/FilesApi.ts +19 -1
- package/src/apis/files/types.ts +20 -1
- package/src/apis/kanbanCards/KanbanCardsApi.test.ts +21 -0
- package/src/apis/kanbanCards/KanbanCardsApi.ts +47 -1
- package/src/apis/kanbanCards/types.ts +1 -1
- package/src/apis/kanbanColumns/KanbanColumnsApi.test.ts +26 -0
- package/src/apis/kanbanColumns/KanbanColumnsApi.ts +31 -0
- package/src/apis/kanbanColumns/types.ts +5 -0
- package/src/apis/messages/MessagesApi.ts +13 -4
- package/src/apis/messages/types.ts +5 -0
- package/src/apis/payloads.test-d.ts +245 -5
- package/src/apis/pipeline/types.ts +7 -8
- package/src/apis/queryFormat.test.ts +13 -0
- package/src/apis/quickReplies/types.ts +4 -1
- package/src/apis/schedule/types.ts +42 -10
- package/src/apis/terms/TermsApi.ts +2 -2
- package/src/apis/tickets/TicketsApi.ts +28 -8
- package/src/apis/tickets/types.ts +4 -1
- package/src/apis/timetable/TimetableApi.ts +6 -0
- package/src/apis/timetable/types.ts +9 -0
- package/src/apis/users/UsersApi.test.ts +17 -0
- package/src/apis/users/UsersApi.ts +21 -3
- package/src/apis/users/types.ts +28 -0
- package/src/apis/webhooks/types.ts +53 -6
- package/src/core/BaseReadApi.ts +2 -2
- package/src/core/errors.ts +4 -1
|
@@ -5,9 +5,6 @@ import { BaseApi } from "../../core/BaseApi.mjs";
|
|
|
5
5
|
* Bots. The list route always paginates (`paginate: false` is ignored), so this class does not
|
|
6
6
|
* extend `BaseCrudApi`. The contexts travel as a list (`BotContextInput` / `BotParsedContext`),
|
|
7
7
|
* not as the stored map that `BotVersionsApi` serves.
|
|
8
|
-
*
|
|
9
|
-
* `GET /bots/:id/errors/export` is not exposed: it answers a binary xlsx, and `ApiClient` only
|
|
10
|
-
* handles JSON/text bodies.
|
|
11
8
|
*/
|
|
12
9
|
var BotsApi = class extends BaseApi {
|
|
13
10
|
basePath = "/bots";
|
|
@@ -73,9 +70,22 @@ var BotsApi = class extends BaseApi {
|
|
|
73
70
|
return this.client.get(`${this.basePath}/${id}/errors${this.toQueryString(query)}`, headers);
|
|
74
71
|
}
|
|
75
72
|
/**
|
|
73
|
+
* Exports the failed steps of the bot runs of the last 30 days as an xlsx workbook (binary).
|
|
74
|
+
* Needs a client with `requestRaw`. A period without errors answers 400 `No errors found to
|
|
75
|
+
* export`; an unknown bot answers 404.
|
|
76
|
+
* @permissions bots.view
|
|
77
|
+
*/
|
|
78
|
+
async exportErrors(id, headers) {
|
|
79
|
+
if (!this.client.requestRaw) throw new Error("exportErrors needs a client with requestRaw (the answer is a binary xlsx)");
|
|
80
|
+
return (await this.client.requestRaw("GET", `${this.basePath}/${id}/errors/export`, void 0, headers)).arrayBuffer();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
76
83
|
* Fires the `API_SIGNAL` trigger of the bot for the contact, with an optional `flag` (read by
|
|
77
84
|
* the `api_signal_flag` condition). Asynchronous: always resolves with no content, and the
|
|
78
|
-
* worker only runs it when the contact has an open ticket.
|
|
85
|
+
* worker only runs it when the contact has an open ticket. The worker runs the flow of `botId`
|
|
86
|
+
* on the engine of the bot of the contact's connection (see `BotSettings.botCreatedVersion`; when
|
|
87
|
+
* the connection has no bot, the engine of the `botId` bot). `triggerSignal` does not reach the
|
|
88
|
+
* bot simulator (there the `API_SIGNAL` path is picked by hand, with no `flag`).
|
|
79
89
|
* @permissions bots.view
|
|
80
90
|
*/
|
|
81
91
|
triggerSignal(botId, contactId, flag, headers) {
|
|
@@ -93,9 +103,8 @@ var BotsApi = class extends BaseApi {
|
|
|
93
103
|
}
|
|
94
104
|
/**
|
|
95
105
|
* Generates a prompt for an AI agent of the bot. COSTS one AI agent credit of the account and
|
|
96
|
-
* calls OpenAI.
|
|
97
|
-
*
|
|
98
|
-
* (`Agent limit reached`), answers 500.
|
|
106
|
+
* calls OpenAI. A missing field answers 400; an option outside the lists, or the AI agent limit
|
|
107
|
+
* of the account reached (`Agent limit reached`), answers 500.
|
|
99
108
|
*/
|
|
100
109
|
suggestAgentPrompt(body, headers) {
|
|
101
110
|
return this.client.post(`${this.basePath}/suggest-agent-prompt`, body, headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BotsApi.mjs","names":[],"sources":["../../../src/apis/bots/BotsApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type {\n GetByIdQuery,\n HasCreate,\n HasDeleteById,\n HasGetById,\n HasUpdateById,\n ListQuery,\n Paginated,\n} from '../../core/types'\nimport type {\n Bot,\n BotErrorsQuery,\n BotHistory,\n CreateBotPayload,\n SuggestAgentPromptPayload,\n UpdateBotPayload,\n} from './types'\n\n/**\n * Bots. The list route always paginates (`paginate: false` is ignored), so this class does not\n * extend `BaseCrudApi`. The contexts travel as a list (`BotContextInput` / `BotParsedContext`),\n * not as the stored map that `BotVersionsApi` serves.\n
|
|
1
|
+
{"version":3,"file":"BotsApi.mjs","names":[],"sources":["../../../src/apis/bots/BotsApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type {\n GetByIdQuery,\n HasCreate,\n HasDeleteById,\n HasGetById,\n HasUpdateById,\n ListQuery,\n Paginated,\n} from '../../core/types'\nimport type {\n Bot,\n BotErrorsQuery,\n BotHistory,\n CreateBotPayload,\n SuggestAgentPromptPayload,\n UpdateBotPayload,\n} from './types'\n\n/**\n * Bots. The list route always paginates (`paginate: false` is ignored), so this class does not\n * extend `BaseCrudApi`. The contexts travel as a list (`BotContextInput` / `BotParsedContext`),\n * not as the stored map that `BotVersionsApi` serves.\n */\nexport class BotsApi\n extends BaseApi\n implements\n HasGetById<Bot>,\n HasCreate<Bot, CreateBotPayload>,\n HasUpdateById<Bot, UpdateBotPayload>,\n HasDeleteById<'OK' | false>\n{\n public readonly basePath = '/bots'\n\n /**\n * Lists the bots of the account. Always paginated, even with `paginate: false`.\n * @permissions bots.view\n */\n getMany(query?: ListQuery<Bot>, headers?: Record<string, string>): Promise<Paginated<Bot>> {\n return this.client.get<Paginated<Bot>>(`${this.basePath}${this.toQueryString(query)}`, headers)\n }\n\n /**\n * Returns the first bot matching the query, or `null` when none match.\n * @permissions bots.view\n */\n async getOne(query?: ListQuery<Bot>, headers?: Record<string, string>): Promise<Bot | null> {\n const page = await this.getMany({ ...query, perPage: 1, page: 1 }, headers)\n return page?.data?.[0] ?? null\n }\n\n /**\n * Returns a bot by ID, with `defaultContexts` (the stored map, as a JSON string). An unknown id\n * answers 500, not an empty body.\n * @permissions bots.view\n */\n getById(id: string, query?: GetByIdQuery<Bot>, headers?: Record<string, string>): Promise<Bot> {\n return this.client.get<Bot>(`${this.basePath}/${id}${this.toQueryString(query)}`, headers)\n }\n\n /**\n * Creates a bot and its first version (published, or a draft with `isDraft`). A duplicate name\n * answers 409, unless the account allows duplicate names. Send `flowJson` with `edges`, or the\n * bot never sends a message (SD-2323).\n * @permissions bots.create\n */\n create(body: CreateBotPayload, headers?: Record<string, string>): Promise<Bot> {\n return this.client.post<Bot, CreateBotPayload>(this.basePath, body, headers)\n }\n\n /**\n * Saves the flow (publishing a version, or into the draft with `isDraft`), or only renames the\n * bot with `onlyUpdateBotName`. Resolves to the bot with `defaultContexts` as an object.\n * @permissions bots.view OR bots.update\n */\n updateById(id: string, body: UpdateBotPayload, headers?: Record<string, string>): Promise<Bot> {\n return this.client.put<Bot, UpdateBotPayload>(`${this.basePath}/${id}`, body, headers)\n }\n\n /**\n * Deletes a bot and its versions (hard delete). Today resolves to `false` even when the bot was\n * deleted (the backend destroy returns nothing); it becomes `'OK'` once the destroy returns the\n * bot, as in the other routes. Do not read the result as success or failure. An unknown id\n * answers 500.\n * @permissions bots.view OR bots.destroy\n */\n deleteById(id: string, headers?: Record<string, string>): Promise<'OK' | false> {\n return this.client.delete<'OK' | false>(`${this.basePath}/${id}`, headers)\n }\n\n /**\n * Lists the failed steps of the bot runs, newest first by default. An unknown bot answers an\n * empty page.\n * @permissions bots.view\n */\n getErrors(\n id: string,\n query?: BotErrorsQuery,\n headers?: Record<string, string>,\n ): Promise<Paginated<BotHistory>> {\n return this.client.get<Paginated<BotHistory>>(\n `${this.basePath}/${id}/errors${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Exports the failed steps of the bot runs of the last 30 days as an xlsx workbook (binary).\n * Needs a client with `requestRaw`. A period without errors answers 400 `No errors found to\n * export`; an unknown bot answers 404.\n * @permissions bots.view\n */\n async exportErrors(id: string, headers?: Record<string, string>): Promise<ArrayBuffer> {\n if (!this.client.requestRaw) {\n throw new Error('exportErrors needs a client with requestRaw (the answer is a binary xlsx)')\n }\n const response = await this.client.requestRaw(\n 'GET',\n `${this.basePath}/${id}/errors/export`,\n undefined,\n headers,\n )\n return response.arrayBuffer()\n }\n\n /**\n * Fires the `API_SIGNAL` trigger of the bot for the contact, with an optional `flag` (read by\n * the `api_signal_flag` condition). Asynchronous: always resolves with no content, and the\n * worker only runs it when the contact has an open ticket. The worker runs the flow of `botId`\n * on the engine of the bot of the contact's connection (see `BotSettings.botCreatedVersion`; when\n * the connection has no bot, the engine of the `botId` bot). `triggerSignal` does not reach the\n * bot simulator (there the `API_SIGNAL` path is picked by hand, with no `flag`).\n * @permissions bots.view\n */\n triggerSignal(\n botId: string,\n contactId: string,\n flag?: string,\n headers?: Record<string, string>,\n ): Promise<void> {\n return this.client.post<void, { flag: string } | undefined>(\n `${this.basePath}/${botId}/trigger-signal/${contactId}`,\n flag === undefined ? undefined : { flag },\n headers,\n )\n }\n\n /**\n * Answers a pending asynchronous `HTTP_REQUEST` action: `body` becomes the response the bot\n * reads. Resolves with no content. An unknown history answers 404; a history that is not\n * `PENDING`, or of another bot, answers 400. JSON bodies only (the route also takes text, XML\n * and CSV), up to 250 KB.\n * @permissions bots.view\n */\n requestCallback(\n id: string,\n pendingRequestId: string,\n body: unknown,\n headers?: Record<string, string>,\n ): Promise<void> {\n return this.client.post<void, unknown>(\n `${this.basePath}/${id}/request-callback/${pendingRequestId}`,\n body,\n headers,\n )\n }\n\n /**\n * Generates a prompt for an AI agent of the bot. COSTS one AI agent credit of the account and\n * calls OpenAI. A missing field answers 400; an option outside the lists, or the AI agent limit\n * of the account reached (`Agent limit reached`), answers 500.\n */\n suggestAgentPrompt(\n body: SuggestAgentPromptPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, SuggestAgentPromptPayload>(\n `${this.basePath}/suggest-agent-prompt`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;AAwBA,IAAa,UAAb,cACU,QAMV;CACE,AAAgB,WAAW;;;;;CAM3B,QAAQ,OAAwB,SAA2D;AACzF,SAAO,KAAK,OAAO,IAAoB,GAAG,KAAK,WAAW,KAAK,cAAc,MAAM,IAAI,QAAQ;;;;;;CAOjG,MAAM,OAAO,OAAwB,SAAuD;AAE1F,UADa,MAAM,KAAK,QAAQ;GAAE,GAAG;GAAO,SAAS;GAAG,MAAM;GAAG,EAAE,QAAQ,GAC9D,OAAO,MAAM;;;;;;;CAQ5B,QAAQ,IAAY,OAA2B,SAAgD;AAC7F,SAAO,KAAK,OAAO,IAAS,GAAG,KAAK,SAAS,GAAG,KAAK,KAAK,cAAc,MAAM,IAAI,QAAQ;;;;;;;;CAS5F,OAAO,MAAwB,SAAgD;AAC7E,SAAO,KAAK,OAAO,KAA4B,KAAK,UAAU,MAAM,QAAQ;;;;;;;CAQ9E,WAAW,IAAY,MAAwB,SAAgD;AAC7F,SAAO,KAAK,OAAO,IAA2B,GAAG,KAAK,SAAS,GAAG,MAAM,MAAM,QAAQ;;;;;;;;;CAUxF,WAAW,IAAY,SAAyD;AAC9E,SAAO,KAAK,OAAO,OAAqB,GAAG,KAAK,SAAS,GAAG,MAAM,QAAQ;;;;;;;CAQ5E,UACE,IACA,OACA,SACgC;AAChC,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,GAAG,GAAG,SAAS,KAAK,cAAc,MAAM,IACzD,QACD;;;;;;;;CASH,MAAM,aAAa,IAAY,SAAwD;AACrF,MAAI,CAAC,KAAK,OAAO,WACf,OAAM,IAAI,MAAM,4EAA4E;AAQ9F,UANiB,MAAM,KAAK,OAAO,WACjC,OACA,GAAG,KAAK,SAAS,GAAG,GAAG,iBACvB,QACA,QACD,EACe,aAAa;;;;;;;;;;;CAY/B,cACE,OACA,WACA,MACA,SACe;AACf,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,MAAM,kBAAkB,aAC5C,SAAS,SAAY,SAAY,EAAE,MAAM,EACzC,QACD;;;;;;;;;CAUH,gBACE,IACA,kBACA,MACA,SACe;AACf,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,oBAAoB,oBAC3C,MACA,QACD;;;;;;;CAQH,mBACE,MACA,SACiB;AACjB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,wBACjB,MACA,QACD"}
|
|
@@ -9,7 +9,11 @@ export type BotLimitations = {
|
|
|
9
9
|
export type BotSettings = {
|
|
10
10
|
/** If true, only the first matching rule per trigger fires; otherwise all matching rules fire. */
|
|
11
11
|
sequentialRuleExecution?: boolean;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Version of the bot builder used to create this bot, which also picks the engine that runs it:
|
|
14
|
+
* `v3` (the visual flow builder) runs on the flow engine; `v1`, `v2` or absent, on the legacy
|
|
15
|
+
* engine. The bot simulator always runs the flow engine.
|
|
16
|
+
*/
|
|
13
17
|
botCreatedVersion?: BotCreatedVersion;
|
|
14
18
|
limitations?: BotLimitations;
|
|
15
19
|
};
|
|
@@ -162,6 +166,11 @@ export type BotActionDataMap = {
|
|
|
162
166
|
waitSeconds?: number;
|
|
163
167
|
};
|
|
164
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* Runs on the flow engine (`botCreatedVersion: 'v3'`). `endpointUrl`, `httpMethod`, `retries`,
|
|
171
|
+
* `timeout` and `bodyType` are required to run it: without one of them the step does not run.
|
|
172
|
+
* The bot simulator does not run it.
|
|
173
|
+
*/
|
|
165
174
|
HTTP_REQUEST: {
|
|
166
175
|
requestName?: string;
|
|
167
176
|
endpointUrl?: string;
|
|
@@ -182,8 +191,9 @@ export type BotActionDataMap = {
|
|
|
182
191
|
}[];
|
|
183
192
|
requestBodyJson?: string;
|
|
184
193
|
requestBodyXml?: string;
|
|
194
|
+
/** Number of attempts (at least 1), not of retries after the first one. */
|
|
185
195
|
retries?: number;
|
|
186
|
-
/** Timeout in
|
|
196
|
+
/** Timeout of each attempt, in SECONDS. */
|
|
187
197
|
timeout?: number;
|
|
188
198
|
/** Response properties to extract into bot session variables. */
|
|
189
199
|
variables?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/bots/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAIhD,MAAM,MAAM,iBAAiB,GAAG,IAAI,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A;CACxB,CAAA"}
|
|
@@ -13,12 +13,30 @@ qs = require_chunk.__toESM(qs);
|
|
|
13
13
|
* {@link CampaignListQuery}); `getById` of an unknown id resolves `null`. `deleteById` answers the
|
|
14
14
|
* text `'OK'`. `getMany({ paginate: false })` answers 400 `FILTER_PARAM_INVALID` with the default
|
|
15
15
|
* `'json'` query format (the route only takes `paginate` as a string): use `withQueryFormat('qs')`.
|
|
16
|
+
* `getOne` reads a page of one campaign, so it works with every query format.
|
|
16
17
|
*/
|
|
17
18
|
var CampaignsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
18
19
|
constructor(client) {
|
|
19
20
|
super(client, "/campaigns");
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
23
|
+
* Returns the first campaign matching the query, or `null` when none match. Reads the first page
|
|
24
|
+
* with one campaign (`page: 1`, `perPage: 1`: the `page` and `perPage` of the query are
|
|
25
|
+
* replaced, and its `paginate` and `limit` are left out), so the campaign comes with the `stats`
|
|
26
|
+
* of `getMany`.
|
|
27
|
+
* @permissions campaigns.view
|
|
28
|
+
*/
|
|
29
|
+
async getOne(query, headers) {
|
|
30
|
+
const pageQuery = {
|
|
31
|
+
...query,
|
|
32
|
+
page: 1,
|
|
33
|
+
perPage: 1
|
|
34
|
+
};
|
|
35
|
+
delete pageQuery.paginate;
|
|
36
|
+
delete pageQuery.limit;
|
|
37
|
+
return (await this.client.get(`${this.basePath}${this.toQueryString(pageQuery)}`, headers))?.data?.[0] ?? null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
22
40
|
* Starts sending the campaign: answers it as `processing` (an `import_error` campaign goes back
|
|
23
41
|
* to `importing_contacts`). It becomes `done` once every contact is fired.
|
|
24
42
|
* @permissions campaigns.view
|
|
@@ -125,7 +143,13 @@ var CampaignsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
|
|
|
125
143
|
deleteMany(ids, headers) {
|
|
126
144
|
return this.client.request("DELETE", `${this.basePath}/delete-many`, { ids }, headers);
|
|
127
145
|
}
|
|
128
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Returns the HSM message usage and limit of the account of the current user (send its
|
|
148
|
+
* `accountId`).
|
|
149
|
+
* @deprecated Use `WhatsappBusinessTemplatesApi.getHsmLimit` (the same route, outside
|
|
150
|
+
* `/campaigns`).
|
|
151
|
+
* @permissions hsm.view
|
|
152
|
+
*/
|
|
129
153
|
getHsmLimit(accountId, headers) {
|
|
130
154
|
return this.client.get(`/whatsapp-business-templates/${accountId}/hsmLimit`, headers);
|
|
131
155
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CampaignsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/campaigns/CampaignsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core'\nimport { BaseCrudApi } from '../../core'\nimport type {\n AutoPauseModePayload,\n Campaign,\n CampaignContactsPage,\n CampaignContactsQuery,\n CampaignListQuery,\n CampaignStats,\n CampaignTimelineEvent,\n CreateCampaignPayload,\n ExportCampaignImportErrorsQuery,\n ExportCampaignResultPayload,\n ExportTemplateCsvPayload,\n HsmLimit,\n SetIntervalPayload,\n UpdateCampaignPayload,\n} from './types'\n\n/**\n * Campaigns (mass sending). Every `/campaigns` route requires the campaigns feature in the plan of\n * the account.\n * `getMany` takes the `where` of a `ListQuery` and the flat filters of the Campaigns screen (see\n * {@link CampaignListQuery}); `getById` of an unknown id resolves `null`. `deleteById` answers the\n * text `'OK'`. `getMany({ paginate: false })` answers 400 `FILTER_PARAM_INVALID` with the default\n * `'json'` query format (the route only takes `paginate` as a string): use `withQueryFormat('qs')`.\n */\nexport class CampaignsApi extends BaseCrudApi<\n Campaign,\n CreateCampaignPayload,\n UpdateCampaignPayload,\n CampaignListQuery,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/campaigns')\n }\n\n /**\n * Starts sending the campaign: answers it as `processing` (an `import_error` campaign goes back\n * to `importing_contacts`). It becomes `done` once every contact is fired.\n * @permissions campaigns.view\n */\n sendById(id: string, headers?: Record<string, string>): Promise<Campaign> {\n return this.client.post<Campaign>(`${this.basePath}/${id}/send`, undefined, headers)\n }\n\n /**\n * Sets the campaign as `paused` and answers `true`. An unknown id answers 500.\n * @permissions campaigns.view\n */\n pauseById(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>(`${this.basePath}/${id}/pause`, undefined, headers)\n }\n\n /**\n * Sets the campaign back to `processing` and answers `true`. An unknown id answers 500.\n * @permissions campaigns.view\n */\n resumeById(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>(`${this.basePath}/${id}/resume`, undefined, headers)\n }\n\n /**\n * Fires again the messages that failed: sets them as pending and the campaign as `processing`.\n * Answers the text `'OK'` (also when nothing failed, and then the status does not change); an\n * unknown id answers `false` (status 200).\n * @permissions campaigns.view\n */\n retryById(id: string, headers?: Record<string, string>): Promise<'OK' | false> {\n return this.client.post<'OK' | false>(`${this.basePath}/${id}/retry`, undefined, headers)\n }\n\n /**\n * Creates a copy of the campaign (`ready`, same title, messages and tags), answered without the\n * messages. An unknown id answers 500.\n * @permissions campaigns.view\n */\n duplicateById(id: string, headers?: Record<string, string>): Promise<Campaign> {\n return this.client.post<Campaign>(`${this.basePath}/${id}/duplicate`, undefined, headers)\n }\n\n /** Returns the send, delivery and interaction statistics of the campaign. */\n getStatsById(id: string, headers?: Record<string, string>): Promise<CampaignStats> {\n return this.client.get<CampaignStats>(`${this.basePath}/${id}/stats`, headers)\n }\n\n /**\n * Returns the events of the campaign (created, scheduled, started, finished and the last\n * interruption), the most recent first.\n */\n getTimeline(id: string, headers?: Record<string, string>): Promise<CampaignTimelineEvent[]> {\n return this.client.get<CampaignTimelineEvent[]>(`${this.basePath}/${id}/timeline`, headers)\n }\n\n /**\n * Returns a page of the contacts of the campaign with their sending status (15 per page by\n * default). An unknown id answers an empty page.\n */\n getContacts(\n id: string,\n query?: CampaignContactsQuery,\n headers?: Record<string, string>,\n ): Promise<CampaignContactsPage> {\n return this.client.get<CampaignContactsPage>(\n `${this.basePath}/${id}/contacts${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Sets the min/max interval between the sends (whole numbers, `0` or more) and answers `true`.\n * An unknown id answers 500.\n * @permissions campaigns.view\n */\n setIntervalById(\n id: string,\n data: SetIntervalPayload,\n headers?: Record<string, string>,\n ): Promise<boolean> {\n return this.client.post<boolean, SetIntervalPayload>(\n `${this.basePath}/${id}/interval`,\n data,\n headers,\n )\n }\n\n /** Returns the number of contacts targeted by the campaign. */\n getContactCount(id: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/${id}/contactCount`, headers)\n }\n\n /** Counts the `ready` campaigns of a connection. An unknown id counts 0. */\n countReadyByService(serviceId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-ready/${serviceId}`, headers)\n }\n\n /**\n * Sets the auto-pause mode of the campaigns of the account (`settings.campaign`). Answers the\n * text `'OK'`, or `false` when the account was not updated.\n */\n setAutoPauseMode(\n data: AutoPauseModePayload,\n headers?: Record<string, string>,\n ): Promise<'OK' | false> {\n return this.client.put<'OK' | false, AutoPauseModePayload>(\n `${this.basePath}/autoPauseMode`,\n data,\n headers,\n )\n }\n\n /**\n * Exports the contacts of the campaign and their sending result as CSV (13 columns in the\n * language of the user; `,`, or `;` with `type: 'semiColon'`), streamed without a Content-Type.\n */\n exportCampaignResult(\n data: ExportCampaignResultPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportCampaignResultPayload>(\n `${this.basePath}/export/csv`,\n data,\n headers,\n )\n }\n\n /** Exports the CSV (`;`) to fill in the contacts of a campaign of the given HSM template. */\n exportTemplateCsv(\n data: ExportTemplateCsvPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportTemplateCsvPayload>(\n `${this.basePath}/exportTemplate`,\n data,\n headers,\n )\n }\n\n /**\n * Exports the rows of the import file that were not imported (invalid number, unknown or\n * ambiguous username) as CSV: line, name, number, username and reason.\n */\n exportImportErrors(\n id: string,\n query?: ExportCampaignImportErrorsQuery,\n headers?: Record<string, string>,\n ): Promise<string> {\n const queryString = query?.delimiter ? `?${qs.stringify({ delimiter: query.delimiter })}` : ''\n return this.client.get<string>(`${this.basePath}/${id}/import-errors${queryString}`, headers)\n }\n\n /**\n * Deletes the campaigns of the given ids and answers `true` (unknown ids are skipped). No id, or\n * an id that is not a UUID, answers 400 `{ error: 'Invalid ids', code: 'INVALID_IDS' }`.\n * @permissions campaigns.view OR campaigns.destroy\n */\n deleteMany(ids: string[], headers?: Record<string, string>): Promise<true> {\n return this.client.request<true, { ids: string[] }>(\n 'DELETE',\n `${this.basePath}/delete-many`,\n { ids },\n headers,\n )\n }\n\n /** Returns the HSM message usage and limit of an account. */\n getHsmLimit(accountId: string, headers?: Record<string, string>): Promise<HsmLimit> {\n return this.client.get<HsmLimit>(`/whatsapp-business-templates/${accountId}/hsmLimit`, headers)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA4BA,IAAa,eAAb,cAAkCA,qCAMhC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,aAAa;;;;;;;CAQ7B,SAAS,IAAY,SAAqD;AACxE,SAAO,KAAK,OAAO,KAAe,GAAG,KAAK,SAAS,GAAG,GAAG,QAAQ,QAAW,QAAQ;;;;;;CAOtF,UAAU,IAAY,SAAoD;AACxE,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,SAAS,QAAW,QAAQ;;;;;;CAOtF,WAAW,IAAY,SAAoD;AACzE,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,UAAU,QAAW,QAAQ;;;;;;;;CASvF,UAAU,IAAY,SAAyD;AAC7E,SAAO,KAAK,OAAO,KAAmB,GAAG,KAAK,SAAS,GAAG,GAAG,SAAS,QAAW,QAAQ;;;;;;;CAQ3F,cAAc,IAAY,SAAqD;AAC7E,SAAO,KAAK,O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iD;AACzE,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,eACjB,EAAE,KAAK,EACP,QACD;;;CAIH,YAAY,WAAmB,SAAqD;AAClF,SAAO,KAAK,OAAO,IAAc,gCAAgC,UAAU,YAAY,QAAQ"}
|
|
1
|
+
{"version":3,"file":"CampaignsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/campaigns/CampaignsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient, Paginated } from '../../core'\nimport { BaseCrudApi } from '../../core'\nimport type {\n AutoPauseModePayload,\n Campaign,\n CampaignContactsPage,\n CampaignContactsQuery,\n CampaignListQuery,\n CampaignStats,\n CampaignTimelineEvent,\n CreateCampaignPayload,\n ExportCampaignImportErrorsQuery,\n ExportCampaignResultPayload,\n ExportTemplateCsvPayload,\n HsmLimit,\n SetIntervalPayload,\n UpdateCampaignPayload,\n} from './types'\n\n/**\n * Campaigns (mass sending). Every `/campaigns` route requires the campaigns feature in the plan of\n * the account.\n * `getMany` takes the `where` of a `ListQuery` and the flat filters of the Campaigns screen (see\n * {@link CampaignListQuery}); `getById` of an unknown id resolves `null`. `deleteById` answers the\n * text `'OK'`. `getMany({ paginate: false })` answers 400 `FILTER_PARAM_INVALID` with the default\n * `'json'` query format (the route only takes `paginate` as a string): use `withQueryFormat('qs')`.\n * `getOne` reads a page of one campaign, so it works with every query format.\n */\nexport class CampaignsApi extends BaseCrudApi<\n Campaign,\n CreateCampaignPayload,\n UpdateCampaignPayload,\n CampaignListQuery,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/campaigns')\n }\n\n /**\n * Returns the first campaign matching the query, or `null` when none match. Reads the first page\n * with one campaign (`page: 1`, `perPage: 1`: the `page` and `perPage` of the query are\n * replaced, and its `paginate` and `limit` are left out), so the campaign comes with the `stats`\n * of `getMany`.\n * @permissions campaigns.view\n */\n override async getOne(\n query?: CampaignListQuery,\n headers?: Record<string, string>,\n ): Promise<Campaign | null> {\n const pageQuery: CampaignListQuery = { ...query, page: 1, perPage: 1 }\n delete pageQuery.paginate\n delete pageQuery.limit\n const page = await this.client.get<Paginated<Campaign> | undefined>(\n `${this.basePath}${this.toQueryString(pageQuery)}`,\n headers,\n )\n // An empty response body resolves to `undefined`.\n return page?.data?.[0] ?? null\n }\n\n /**\n * Starts sending the campaign: answers it as `processing` (an `import_error` campaign goes back\n * to `importing_contacts`). It becomes `done` once every contact is fired.\n * @permissions campaigns.view\n */\n sendById(id: string, headers?: Record<string, string>): Promise<Campaign> {\n return this.client.post<Campaign>(`${this.basePath}/${id}/send`, undefined, headers)\n }\n\n /**\n * Sets the campaign as `paused` and answers `true`. An unknown id answers 500.\n * @permissions campaigns.view\n */\n pauseById(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>(`${this.basePath}/${id}/pause`, undefined, headers)\n }\n\n /**\n * Sets the campaign back to `processing` and answers `true`. An unknown id answers 500.\n * @permissions campaigns.view\n */\n resumeById(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>(`${this.basePath}/${id}/resume`, undefined, headers)\n }\n\n /**\n * Fires again the messages that failed: sets them as pending and the campaign as `processing`.\n * Answers the text `'OK'` (also when nothing failed, and then the status does not change); an\n * unknown id answers `false` (status 200).\n * @permissions campaigns.view\n */\n retryById(id: string, headers?: Record<string, string>): Promise<'OK' | false> {\n return this.client.post<'OK' | false>(`${this.basePath}/${id}/retry`, undefined, headers)\n }\n\n /**\n * Creates a copy of the campaign (`ready`, same title, messages and tags), answered without the\n * messages. An unknown id answers 500.\n * @permissions campaigns.view\n */\n duplicateById(id: string, headers?: Record<string, string>): Promise<Campaign> {\n return this.client.post<Campaign>(`${this.basePath}/${id}/duplicate`, undefined, headers)\n }\n\n /** Returns the send, delivery and interaction statistics of the campaign. */\n getStatsById(id: string, headers?: Record<string, string>): Promise<CampaignStats> {\n return this.client.get<CampaignStats>(`${this.basePath}/${id}/stats`, headers)\n }\n\n /**\n * Returns the events of the campaign (created, scheduled, started, finished and the last\n * interruption), the most recent first.\n */\n getTimeline(id: string, headers?: Record<string, string>): Promise<CampaignTimelineEvent[]> {\n return this.client.get<CampaignTimelineEvent[]>(`${this.basePath}/${id}/timeline`, headers)\n }\n\n /**\n * Returns a page of the contacts of the campaign with their sending status (15 per page by\n * default). An unknown id answers an empty page.\n */\n getContacts(\n id: string,\n query?: CampaignContactsQuery,\n headers?: Record<string, string>,\n ): Promise<CampaignContactsPage> {\n return this.client.get<CampaignContactsPage>(\n `${this.basePath}/${id}/contacts${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Sets the min/max interval between the sends (whole numbers, `0` or more) and answers `true`.\n * An unknown id answers 500.\n * @permissions campaigns.view\n */\n setIntervalById(\n id: string,\n data: SetIntervalPayload,\n headers?: Record<string, string>,\n ): Promise<boolean> {\n return this.client.post<boolean, SetIntervalPayload>(\n `${this.basePath}/${id}/interval`,\n data,\n headers,\n )\n }\n\n /** Returns the number of contacts targeted by the campaign. */\n getContactCount(id: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/${id}/contactCount`, headers)\n }\n\n /** Counts the `ready` campaigns of a connection. An unknown id counts 0. */\n countReadyByService(serviceId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-ready/${serviceId}`, headers)\n }\n\n /**\n * Sets the auto-pause mode of the campaigns of the account (`settings.campaign`). Answers the\n * text `'OK'`, or `false` when the account was not updated.\n */\n setAutoPauseMode(\n data: AutoPauseModePayload,\n headers?: Record<string, string>,\n ): Promise<'OK' | false> {\n return this.client.put<'OK' | false, AutoPauseModePayload>(\n `${this.basePath}/autoPauseMode`,\n data,\n headers,\n )\n }\n\n /**\n * Exports the contacts of the campaign and their sending result as CSV (13 columns in the\n * language of the user; `,`, or `;` with `type: 'semiColon'`), streamed without a Content-Type.\n */\n exportCampaignResult(\n data: ExportCampaignResultPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportCampaignResultPayload>(\n `${this.basePath}/export/csv`,\n data,\n headers,\n )\n }\n\n /** Exports the CSV (`;`) to fill in the contacts of a campaign of the given HSM template. */\n exportTemplateCsv(\n data: ExportTemplateCsvPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportTemplateCsvPayload>(\n `${this.basePath}/exportTemplate`,\n data,\n headers,\n )\n }\n\n /**\n * Exports the rows of the import file that were not imported (invalid number, unknown or\n * ambiguous username) as CSV: line, name, number, username and reason.\n */\n exportImportErrors(\n id: string,\n query?: ExportCampaignImportErrorsQuery,\n headers?: Record<string, string>,\n ): Promise<string> {\n const queryString = query?.delimiter ? `?${qs.stringify({ delimiter: query.delimiter })}` : ''\n return this.client.get<string>(`${this.basePath}/${id}/import-errors${queryString}`, headers)\n }\n\n /**\n * Deletes the campaigns of the given ids and answers `true` (unknown ids are skipped). No id, or\n * an id that is not a UUID, answers 400 `{ error: 'Invalid ids', code: 'INVALID_IDS' }`.\n * @permissions campaigns.view OR campaigns.destroy\n */\n deleteMany(ids: string[], headers?: Record<string, string>): Promise<true> {\n return this.client.request<true, { ids: string[] }>(\n 'DELETE',\n `${this.basePath}/delete-many`,\n { ids },\n headers,\n )\n }\n\n /**\n * Returns the HSM message usage and limit of the account of the current user (send its\n * `accountId`).\n * @deprecated Use `WhatsappBusinessTemplatesApi.getHsmLimit` (the same route, outside\n * `/campaigns`).\n * @permissions hsm.view\n */\n getHsmLimit(accountId: string, headers?: Record<string, string>): Promise<HsmLimit> {\n return this.client.get<HsmLimit>(`/whatsapp-business-templates/${accountId}/hsmLimit`, headers)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,IAAa,eAAb,cAAkCA,qCAMhC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,aAAa;;;;;;;;;CAU7B,MAAe,OACb,OACA,SAC0B;EAC1B,MAAM,YAA+B;GAAE,GAAG;GAAO,MAAM;GAAG,SAAS;GAAG;AACtE,SAAO,UAAU;AACjB,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BAAgB,QAAQ;;;CAIhF,oBAAoB,WAAmB,SAAmD;AACxF,SAAO,KAAK,OAAO,IAAY,GAAG,KAAK,SAAS,eAAe,aAAa,QAAQ;;;;;;CAOtF,iBACE,MACA,SACuB;AACvB,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,iBACjB,MACA,QACD;;;;;;CAOH,qBACE,MACA,SACiB;AACjB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,cACjB,MACA,QACD;;;CAIH,kBACE,MACA,SACiB;AACjB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,kBACjB,MACA,QACD;;;;;;CAOH,mBACE,IACA,OACA,SACiB;EACjB,MAAM,cAAc,OAAO,YAAY,IAAI,WAAG,UAAU,EAAE,WAAW,MAAM,WAAW,CAAC,KAAK;AAC5F,SAAO,KAAK,OAAO,IAAY,GAAG,KAAK,SAAS,GAAG,GAAG,gBAAgB,eAAe,QAAQ;;;;;;;CAQ/F,WAAW,KAAe,SAAiD;AACzE,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,eACjB,EAAE,KAAK,EACP,QACD;;;;;;;;;CAUH,YAAY,WAAmB,SAAqD;AAClF,SAAO,KAAK,OAAO,IAAc,gCAAgC,UAAU,YAAY,QAAQ"}
|
|
@@ -8,9 +8,18 @@ import type { AutoPauseModePayload, Campaign, CampaignContactsPage, CampaignCont
|
|
|
8
8
|
* {@link CampaignListQuery}); `getById` of an unknown id resolves `null`. `deleteById` answers the
|
|
9
9
|
* text `'OK'`. `getMany({ paginate: false })` answers 400 `FILTER_PARAM_INVALID` with the default
|
|
10
10
|
* `'json'` query format (the route only takes `paginate` as a string): use `withQueryFormat('qs')`.
|
|
11
|
+
* `getOne` reads a page of one campaign, so it works with every query format.
|
|
11
12
|
*/
|
|
12
13
|
export declare class CampaignsApi extends BaseCrudApi<Campaign, CreateCampaignPayload, UpdateCampaignPayload, CampaignListQuery, 'OK'> {
|
|
13
14
|
constructor(client: ApiClient);
|
|
15
|
+
/**
|
|
16
|
+
* Returns the first campaign matching the query, or `null` when none match. Reads the first page
|
|
17
|
+
* with one campaign (`page: 1`, `perPage: 1`: the `page` and `perPage` of the query are
|
|
18
|
+
* replaced, and its `paginate` and `limit` are left out), so the campaign comes with the `stats`
|
|
19
|
+
* of `getMany`.
|
|
20
|
+
* @permissions campaigns.view
|
|
21
|
+
*/
|
|
22
|
+
getOne(query?: CampaignListQuery, headers?: Record<string, string>): Promise<Campaign | null>;
|
|
14
23
|
/**
|
|
15
24
|
* Starts sending the campaign: answers it as `processing` (an `import_error` campaign goes back
|
|
16
25
|
* to `importing_contacts`). It becomes `done` once every contact is fired.
|
|
@@ -85,7 +94,13 @@ export declare class CampaignsApi extends BaseCrudApi<Campaign, CreateCampaignPa
|
|
|
85
94
|
* @permissions campaigns.view OR campaigns.destroy
|
|
86
95
|
*/
|
|
87
96
|
deleteMany(ids: string[], headers?: Record<string, string>): Promise<true>;
|
|
88
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Returns the HSM message usage and limit of the account of the current user (send its
|
|
99
|
+
* `accountId`).
|
|
100
|
+
* @deprecated Use `WhatsappBusinessTemplatesApi.getHsmLimit` (the same route, outside
|
|
101
|
+
* `/campaigns`).
|
|
102
|
+
* @permissions hsm.view
|
|
103
|
+
*/
|
|
89
104
|
getHsmLimit(accountId: string, headers?: Record<string, string>): Promise<HsmLimit>;
|
|
90
105
|
}
|
|
91
106
|
//# sourceMappingURL=CampaignsApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CampaignsApi.d.ts","sourceRoot":"","sources":["../../../src/apis/campaigns/CampaignsApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"CampaignsApi.d.ts","sourceRoot":"","sources":["../../../src/apis/campaigns/CampaignsApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,YAAY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2BAA2B,EACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC;IAQlB,6FAA6F;IAC7F,iBAAiB,CACf,IAAI,EAAE,wBAAwB,EAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC;IAQlB;;;OAGG;IACH,kBAAkB,CAChB,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,+BAA+B,EACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC;IAKlB;;;;OAIG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1E;;;;;;OAMG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC;CAGpF"}
|
|
@@ -10,12 +10,30 @@ import qs from "qs";
|
|
|
10
10
|
* {@link CampaignListQuery}); `getById` of an unknown id resolves `null`. `deleteById` answers the
|
|
11
11
|
* text `'OK'`. `getMany({ paginate: false })` answers 400 `FILTER_PARAM_INVALID` with the default
|
|
12
12
|
* `'json'` query format (the route only takes `paginate` as a string): use `withQueryFormat('qs')`.
|
|
13
|
+
* `getOne` reads a page of one campaign, so it works with every query format.
|
|
13
14
|
*/
|
|
14
15
|
var CampaignsApi = class extends BaseCrudApi {
|
|
15
16
|
constructor(client) {
|
|
16
17
|
super(client, "/campaigns");
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
20
|
+
* Returns the first campaign matching the query, or `null` when none match. Reads the first page
|
|
21
|
+
* with one campaign (`page: 1`, `perPage: 1`: the `page` and `perPage` of the query are
|
|
22
|
+
* replaced, and its `paginate` and `limit` are left out), so the campaign comes with the `stats`
|
|
23
|
+
* of `getMany`.
|
|
24
|
+
* @permissions campaigns.view
|
|
25
|
+
*/
|
|
26
|
+
async getOne(query, headers) {
|
|
27
|
+
const pageQuery = {
|
|
28
|
+
...query,
|
|
29
|
+
page: 1,
|
|
30
|
+
perPage: 1
|
|
31
|
+
};
|
|
32
|
+
delete pageQuery.paginate;
|
|
33
|
+
delete pageQuery.limit;
|
|
34
|
+
return (await this.client.get(`${this.basePath}${this.toQueryString(pageQuery)}`, headers))?.data?.[0] ?? null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
19
37
|
* Starts sending the campaign: answers it as `processing` (an `import_error` campaign goes back
|
|
20
38
|
* to `importing_contacts`). It becomes `done` once every contact is fired.
|
|
21
39
|
* @permissions campaigns.view
|
|
@@ -122,7 +140,13 @@ var CampaignsApi = class extends BaseCrudApi {
|
|
|
122
140
|
deleteMany(ids, headers) {
|
|
123
141
|
return this.client.request("DELETE", `${this.basePath}/delete-many`, { ids }, headers);
|
|
124
142
|
}
|
|
125
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* Returns the HSM message usage and limit of the account of the current user (send its
|
|
145
|
+
* `accountId`).
|
|
146
|
+
* @deprecated Use `WhatsappBusinessTemplatesApi.getHsmLimit` (the same route, outside
|
|
147
|
+
* `/campaigns`).
|
|
148
|
+
* @permissions hsm.view
|
|
149
|
+
*/
|
|
126
150
|
getHsmLimit(accountId, headers) {
|
|
127
151
|
return this.client.get(`/whatsapp-business-templates/${accountId}/hsmLimit`, headers);
|
|
128
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CampaignsApi.mjs","names":[],"sources":["../../../src/apis/campaigns/CampaignsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core'\nimport { BaseCrudApi } from '../../core'\nimport type {\n AutoPauseModePayload,\n Campaign,\n CampaignContactsPage,\n CampaignContactsQuery,\n CampaignListQuery,\n CampaignStats,\n CampaignTimelineEvent,\n CreateCampaignPayload,\n ExportCampaignImportErrorsQuery,\n ExportCampaignResultPayload,\n ExportTemplateCsvPayload,\n HsmLimit,\n SetIntervalPayload,\n UpdateCampaignPayload,\n} from './types'\n\n/**\n * Campaigns (mass sending). Every `/campaigns` route requires the campaigns feature in the plan of\n * the account.\n * `getMany` takes the `where` of a `ListQuery` and the flat filters of the Campaigns screen (see\n * {@link CampaignListQuery}); `getById` of an unknown id resolves `null`. `deleteById` answers the\n * text `'OK'`. `getMany({ paginate: false })` answers 400 `FILTER_PARAM_INVALID` with the default\n * `'json'` query format (the route only takes `paginate` as a string): use `withQueryFormat('qs')`.\n */\nexport class CampaignsApi extends BaseCrudApi<\n Campaign,\n CreateCampaignPayload,\n UpdateCampaignPayload,\n CampaignListQuery,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/campaigns')\n }\n\n /**\n * Starts sending the campaign: answers it as `processing` (an `import_error` campaign goes back\n * to `importing_contacts`). It becomes `done` once every contact is fired.\n * @permissions campaigns.view\n */\n sendById(id: string, headers?: Record<string, string>): Promise<Campaign> {\n return this.client.post<Campaign>(`${this.basePath}/${id}/send`, undefined, headers)\n }\n\n /**\n * Sets the campaign as `paused` and answers `true`. An unknown id answers 500.\n * @permissions campaigns.view\n */\n pauseById(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>(`${this.basePath}/${id}/pause`, undefined, headers)\n }\n\n /**\n * Sets the campaign back to `processing` and answers `true`. An unknown id answers 500.\n * @permissions campaigns.view\n */\n resumeById(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>(`${this.basePath}/${id}/resume`, undefined, headers)\n }\n\n /**\n * Fires again the messages that failed: sets them as pending and the campaign as `processing`.\n * Answers the text `'OK'` (also when nothing failed, and then the status does not change); an\n * unknown id answers `false` (status 200).\n * @permissions campaigns.view\n */\n retryById(id: string, headers?: Record<string, string>): Promise<'OK' | false> {\n return this.client.post<'OK' | false>(`${this.basePath}/${id}/retry`, undefined, headers)\n }\n\n /**\n * Creates a copy of the campaign (`ready`, same title, messages and tags), answered without the\n * messages. An unknown id answers 500.\n * @permissions campaigns.view\n */\n duplicateById(id: string, headers?: Record<string, string>): Promise<Campaign> {\n return this.client.post<Campaign>(`${this.basePath}/${id}/duplicate`, undefined, headers)\n }\n\n /** Returns the send, delivery and interaction statistics of the campaign. */\n getStatsById(id: string, headers?: Record<string, string>): Promise<CampaignStats> {\n return this.client.get<CampaignStats>(`${this.basePath}/${id}/stats`, headers)\n }\n\n /**\n * Returns the events of the campaign (created, scheduled, started, finished and the last\n * interruption), the most recent first.\n */\n getTimeline(id: string, headers?: Record<string, string>): Promise<CampaignTimelineEvent[]> {\n return this.client.get<CampaignTimelineEvent[]>(`${this.basePath}/${id}/timeline`, headers)\n }\n\n /**\n * Returns a page of the contacts of the campaign with their sending status (15 per page by\n * default). An unknown id answers an empty page.\n */\n getContacts(\n id: string,\n query?: CampaignContactsQuery,\n headers?: Record<string, string>,\n ): Promise<CampaignContactsPage> {\n return this.client.get<CampaignContactsPage>(\n `${this.basePath}/${id}/contacts${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Sets the min/max interval between the sends (whole numbers, `0` or more) and answers `true`.\n * An unknown id answers 500.\n * @permissions campaigns.view\n */\n setIntervalById(\n id: string,\n data: SetIntervalPayload,\n headers?: Record<string, string>,\n ): Promise<boolean> {\n return this.client.post<boolean, SetIntervalPayload>(\n `${this.basePath}/${id}/interval`,\n data,\n headers,\n )\n }\n\n /** Returns the number of contacts targeted by the campaign. */\n getContactCount(id: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/${id}/contactCount`, headers)\n }\n\n /** Counts the `ready` campaigns of a connection. An unknown id counts 0. */\n countReadyByService(serviceId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-ready/${serviceId}`, headers)\n }\n\n /**\n * Sets the auto-pause mode of the campaigns of the account (`settings.campaign`). Answers the\n * text `'OK'`, or `false` when the account was not updated.\n */\n setAutoPauseMode(\n data: AutoPauseModePayload,\n headers?: Record<string, string>,\n ): Promise<'OK' | false> {\n return this.client.put<'OK' | false, AutoPauseModePayload>(\n `${this.basePath}/autoPauseMode`,\n data,\n headers,\n )\n }\n\n /**\n * Exports the contacts of the campaign and their sending result as CSV (13 columns in the\n * language of the user; `,`, or `;` with `type: 'semiColon'`), streamed without a Content-Type.\n */\n exportCampaignResult(\n data: ExportCampaignResultPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportCampaignResultPayload>(\n `${this.basePath}/export/csv`,\n data,\n headers,\n )\n }\n\n /** Exports the CSV (`;`) to fill in the contacts of a campaign of the given HSM template. */\n exportTemplateCsv(\n data: ExportTemplateCsvPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportTemplateCsvPayload>(\n `${this.basePath}/exportTemplate`,\n data,\n headers,\n )\n }\n\n /**\n * Exports the rows of the import file that were not imported (invalid number, unknown or\n * ambiguous username) as CSV: line, name, number, username and reason.\n */\n exportImportErrors(\n id: string,\n query?: ExportCampaignImportErrorsQuery,\n headers?: Record<string, string>,\n ): Promise<string> {\n const queryString = query?.delimiter ? `?${qs.stringify({ delimiter: query.delimiter })}` : ''\n return this.client.get<string>(`${this.basePath}/${id}/import-errors${queryString}`, headers)\n }\n\n /**\n * Deletes the campaigns of the given ids and answers `true` (unknown ids are skipped). No id, or\n * an id that is not a UUID, answers 400 `{ error: 'Invalid ids', code: 'INVALID_IDS' }`.\n * @permissions campaigns.view OR campaigns.destroy\n */\n deleteMany(ids: string[], headers?: Record<string, string>): Promise<true> {\n return this.client.request<true, { ids: string[] }>(\n 'DELETE',\n `${this.basePath}/delete-many`,\n { ids },\n headers,\n )\n }\n\n /** Returns the HSM message usage and limit of an account. */\n getHsmLimit(accountId: string, headers?: Record<string, string>): Promise<HsmLimit> {\n return this.client.get<HsmLimit>(`/whats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G,KAAK,SAAS,GAAG,GAAG,gBAAgB,QAAQ;;;CAIhF,oBAAoB,WAAmB,SAAmD;AACxF,SAAO,KAAK,OAAO,IAAY,GAAG,KAAK,SAAS,eAAe,aAAa,QAAQ;;;;;;CAOtF,iBACE,MACA,SACuB;AACvB,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,iBACjB,MACA,QACD;;;;;;CAOH,qBACE,MACA,SACiB;AACjB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,cACjB,MACA,QACD;;;CAIH,kBACE,MACA,SACiB;AACjB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,kBACjB,MACA,QACD;;;;;;CAOH,mBACE,IACA,OACA,SACiB;EACjB,MAAM,cAAc,OAAO,YAAY,IAAI,GAAG,UAAU,EAAE,WAAW,MAAM,WAAW,CAAC,KAAK;AAC5F,SAAO,KAAK,OAAO,IAAY,GAAG,KAAK,SAAS,GAAG,GAAG,gBAAgB,eAAe,QAAQ;;;;;;;CAQ/F,WAAW,KAAe,SAAiD;AACzE,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,eACjB,EAAE,KAAK,EACP,QACD;;;CAIH,YAAY,WAAmB,SAAqD;AAClF,SAAO,KAAK,OAAO,IAAc,gCAAgC,UAAU,YAAY,QAAQ"}
|
|
1
|
+
{"version":3,"file":"CampaignsApi.mjs","names":[],"sources":["../../../src/apis/campaigns/CampaignsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient, Paginated } from '../../core'\nimport { BaseCrudApi } from '../../core'\nimport type {\n AutoPauseModePayload,\n Campaign,\n CampaignContactsPage,\n CampaignContactsQuery,\n CampaignListQuery,\n CampaignStats,\n CampaignTimelineEvent,\n CreateCampaignPayload,\n ExportCampaignImportErrorsQuery,\n ExportCampaignResultPayload,\n ExportTemplateCsvPayload,\n HsmLimit,\n SetIntervalPayload,\n UpdateCampaignPayload,\n} from './types'\n\n/**\n * Campaigns (mass sending). Every `/campaigns` route requires the campaigns feature in the plan of\n * the account.\n * `getMany` takes the `where` of a `ListQuery` and the flat filters of the Campaigns screen (see\n * {@link CampaignListQuery}); `getById` of an unknown id resolves `null`. `deleteById` answers the\n * text `'OK'`. `getMany({ paginate: false })` answers 400 `FILTER_PARAM_INVALID` with the default\n * `'json'` query format (the route only takes `paginate` as a string): use `withQueryFormat('qs')`.\n * `getOne` reads a page of one campaign, so it works with every query format.\n */\nexport class CampaignsApi extends BaseCrudApi<\n Campaign,\n CreateCampaignPayload,\n UpdateCampaignPayload,\n CampaignListQuery,\n 'OK'\n> {\n constructor(client: ApiClient) {\n super(client, '/campaigns')\n }\n\n /**\n * Returns the first campaign matching the query, or `null` when none match. Reads the first page\n * with one campaign (`page: 1`, `perPage: 1`: the `page` and `perPage` of the query are\n * replaced, and its `paginate` and `limit` are left out), so the campaign comes with the `stats`\n * of `getMany`.\n * @permissions campaigns.view\n */\n override async getOne(\n query?: CampaignListQuery,\n headers?: Record<string, string>,\n ): Promise<Campaign | null> {\n const pageQuery: CampaignListQuery = { ...query, page: 1, perPage: 1 }\n delete pageQuery.paginate\n delete pageQuery.limit\n const page = await this.client.get<Paginated<Campaign> | undefined>(\n `${this.basePath}${this.toQueryString(pageQuery)}`,\n headers,\n )\n // An empty response body resolves to `undefined`.\n return page?.data?.[0] ?? null\n }\n\n /**\n * Starts sending the campaign: answers it as `processing` (an `import_error` campaign goes back\n * to `importing_contacts`). It becomes `done` once every contact is fired.\n * @permissions campaigns.view\n */\n sendById(id: string, headers?: Record<string, string>): Promise<Campaign> {\n return this.client.post<Campaign>(`${this.basePath}/${id}/send`, undefined, headers)\n }\n\n /**\n * Sets the campaign as `paused` and answers `true`. An unknown id answers 500.\n * @permissions campaigns.view\n */\n pauseById(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>(`${this.basePath}/${id}/pause`, undefined, headers)\n }\n\n /**\n * Sets the campaign back to `processing` and answers `true`. An unknown id answers 500.\n * @permissions campaigns.view\n */\n resumeById(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>(`${this.basePath}/${id}/resume`, undefined, headers)\n }\n\n /**\n * Fires again the messages that failed: sets them as pending and the campaign as `processing`.\n * Answers the text `'OK'` (also when nothing failed, and then the status does not change); an\n * unknown id answers `false` (status 200).\n * @permissions campaigns.view\n */\n retryById(id: string, headers?: Record<string, string>): Promise<'OK' | false> {\n return this.client.post<'OK' | false>(`${this.basePath}/${id}/retry`, undefined, headers)\n }\n\n /**\n * Creates a copy of the campaign (`ready`, same title, messages and tags), answered without the\n * messages. An unknown id answers 500.\n * @permissions campaigns.view\n */\n duplicateById(id: string, headers?: Record<string, string>): Promise<Campaign> {\n return this.client.post<Campaign>(`${this.basePath}/${id}/duplicate`, undefined, headers)\n }\n\n /** Returns the send, delivery and interaction statistics of the campaign. */\n getStatsById(id: string, headers?: Record<string, string>): Promise<CampaignStats> {\n return this.client.get<CampaignStats>(`${this.basePath}/${id}/stats`, headers)\n }\n\n /**\n * Returns the events of the campaign (created, scheduled, started, finished and the last\n * interruption), the most recent first.\n */\n getTimeline(id: string, headers?: Record<string, string>): Promise<CampaignTimelineEvent[]> {\n return this.client.get<CampaignTimelineEvent[]>(`${this.basePath}/${id}/timeline`, headers)\n }\n\n /**\n * Returns a page of the contacts of the campaign with their sending status (15 per page by\n * default). An unknown id answers an empty page.\n */\n getContacts(\n id: string,\n query?: CampaignContactsQuery,\n headers?: Record<string, string>,\n ): Promise<CampaignContactsPage> {\n return this.client.get<CampaignContactsPage>(\n `${this.basePath}/${id}/contacts${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Sets the min/max interval between the sends (whole numbers, `0` or more) and answers `true`.\n * An unknown id answers 500.\n * @permissions campaigns.view\n */\n setIntervalById(\n id: string,\n data: SetIntervalPayload,\n headers?: Record<string, string>,\n ): Promise<boolean> {\n return this.client.post<boolean, SetIntervalPayload>(\n `${this.basePath}/${id}/interval`,\n data,\n headers,\n )\n }\n\n /** Returns the number of contacts targeted by the campaign. */\n getContactCount(id: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/${id}/contactCount`, headers)\n }\n\n /** Counts the `ready` campaigns of a connection. An unknown id counts 0. */\n countReadyByService(serviceId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-ready/${serviceId}`, headers)\n }\n\n /**\n * Sets the auto-pause mode of the campaigns of the account (`settings.campaign`). Answers the\n * text `'OK'`, or `false` when the account was not updated.\n */\n setAutoPauseMode(\n data: AutoPauseModePayload,\n headers?: Record<string, string>,\n ): Promise<'OK' | false> {\n return this.client.put<'OK' | false, AutoPauseModePayload>(\n `${this.basePath}/autoPauseMode`,\n data,\n headers,\n )\n }\n\n /**\n * Exports the contacts of the campaign and their sending result as CSV (13 columns in the\n * language of the user; `,`, or `;` with `type: 'semiColon'`), streamed without a Content-Type.\n */\n exportCampaignResult(\n data: ExportCampaignResultPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportCampaignResultPayload>(\n `${this.basePath}/export/csv`,\n data,\n headers,\n )\n }\n\n /** Exports the CSV (`;`) to fill in the contacts of a campaign of the given HSM template. */\n exportTemplateCsv(\n data: ExportTemplateCsvPayload,\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportTemplateCsvPayload>(\n `${this.basePath}/exportTemplate`,\n data,\n headers,\n )\n }\n\n /**\n * Exports the rows of the import file that were not imported (invalid number, unknown or\n * ambiguous username) as CSV: line, name, number, username and reason.\n */\n exportImportErrors(\n id: string,\n query?: ExportCampaignImportErrorsQuery,\n headers?: Record<string, string>,\n ): Promise<string> {\n const queryString = query?.delimiter ? `?${qs.stringify({ delimiter: query.delimiter })}` : ''\n return this.client.get<string>(`${this.basePath}/${id}/import-errors${queryString}`, headers)\n }\n\n /**\n * Deletes the campaigns of the given ids and answers `true` (unknown ids are skipped). No id, or\n * an id that is not a UUID, answers 400 `{ error: 'Invalid ids', code: 'INVALID_IDS' }`.\n * @permissions campaigns.view OR campaigns.destroy\n */\n deleteMany(ids: string[], headers?: Record<string, string>): Promise<true> {\n return this.client.request<true, { ids: string[] }>(\n 'DELETE',\n `${this.basePath}/delete-many`,\n { ids },\n headers,\n )\n }\n\n /**\n * Returns the HSM message usage and limit of the account of the current user (send its\n * `accountId`).\n * @deprecated Use `WhatsappBusinessTemplatesApi.getHsmLimit` (the same route, outside\n * `/campaigns`).\n * @permissions hsm.view\n */\n getHsmLimit(accountId: string, headers?: Record<string, string>): Promise<HsmLimit> {\n return this.client.get<HsmLimit>(`/whatsapp-business-templates/${accountId}/hsmLimit`, headers)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA6BA,IAAa,eAAb,cAAkC,YAMhC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,aAAa;;;;;;;;;CAU7B,MAAe,OACb,OACA,SAC0B;EAC1B,MAAM,YAA+B;GAAE,GAAG;GAAO,MAAM;GAAG,SAAS;GAAG;AACtE,SAAO,UAAU;AACjB,SAAO,UAAU;AAMjB,UALa,MAAM,KAAK,OAAO,IAC7B,GAAG,KAAK,WAAW,KAAK,cAAc,UAAU,IAChD,QACD,GAEY,OAAO,MAAM;;;;;;;CAQ5B,SAAS,IAAY,SAAqD;AACxE,SAAO,KAAK,OAAO,KAAe,GAAG,KAAK,SAAS,GAAG,GAAG,QAAQ,QAAW,QAAQ;;;;;;CAOtF,UAAU,IAAY,SAAoD;AACxE,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,SAAS,QAAW,QAAQ;;;;;;CAOtF,WAAW,IAAY,SAAoD;AACzE,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,UAAU,QAAW,QAAQ;;;;;;;;CASvF,UAAU,IAAY,SAAyD;AAC7E,SAAO,KAAK,OAAO,KAAmB,GAAG,KAAK,SAAS,GAAG,GAAG,SAAS,QAAW,QAAQ;;;;;;;CAQ3F,cAAc,IAAY,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;;;CAQ/F,WAAW,KAAe,SAAiD;AACzE,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,eACjB,EAAE,KAAK,EACP,QACD;;;;;;;;;CAUH,YAAY,WAAmB,SAAqD;AAClF,SAAO,KAAK,OAAO,IAAc,gCAAgC,UAAU,YAAY,QAAQ"}
|
|
@@ -19,6 +19,8 @@ export type CampaignConfig = {
|
|
|
19
19
|
nameField?: string;
|
|
20
20
|
/** Column name in the import file used as the phone number. */
|
|
21
21
|
numberField?: string;
|
|
22
|
+
/** Column name in the import file used as the username (contacts known only by it). */
|
|
23
|
+
usernameField?: string;
|
|
22
24
|
delimiter?: ',' | ';' | ':' | string;
|
|
23
25
|
error?: {
|
|
24
26
|
message: string;
|
|
@@ -49,7 +51,10 @@ export type Campaign = {
|
|
|
49
51
|
marketingIntegration?: boolean;
|
|
50
52
|
/** Always `null`: the campaign has no such column (answered by the transformer). */
|
|
51
53
|
userId?: null;
|
|
52
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* In the pages of `getMany` (not with `paginate: false`) and in `getOne`: messages sent and
|
|
56
|
+
* viewed (ack 3).
|
|
57
|
+
*/
|
|
53
58
|
stats?: {
|
|
54
59
|
sent: number;
|
|
55
60
|
viewed: number;
|
|
@@ -90,9 +95,20 @@ export type CampaignMessage = {
|
|
|
90
95
|
hsm?: WhatsappBusinessTemplate | null;
|
|
91
96
|
};
|
|
92
97
|
export type CampaignRelationships = 'service' | 'defaultDepartment' | 'defaultUser' | 'createdBy' | 'sentBy' | 'tags' | 'messages' | 'importFile';
|
|
98
|
+
/** The media of a header parameter of the template (send it as `{ link: '<url>' }`). */
|
|
99
|
+
export type CampaignTemplateMedia = {
|
|
100
|
+
link?: string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* A parameter of the template: `text`, or the media of its `type` (`image`, `video` or
|
|
104
|
+
* `document`).
|
|
105
|
+
*/
|
|
93
106
|
export type CampaignTemplateParameterItem = {
|
|
94
107
|
type: string;
|
|
95
108
|
text?: string;
|
|
109
|
+
image?: CampaignTemplateMedia;
|
|
110
|
+
video?: CampaignTemplateMedia;
|
|
111
|
+
document?: CampaignTemplateMedia;
|
|
96
112
|
};
|
|
97
113
|
export type CampaignTemplateParameter = {
|
|
98
114
|
type: string;
|
|
@@ -106,6 +122,14 @@ export type CampaignFileTemplate = {
|
|
|
106
122
|
mimetype?: string;
|
|
107
123
|
name?: string;
|
|
108
124
|
};
|
|
125
|
+
/** A message of the campaign to create (without `hsm`, the campaign sends these). */
|
|
126
|
+
export type CampaignMessageInput = {
|
|
127
|
+
text?: string;
|
|
128
|
+
/** The attachment of the message, as a data URL (`data:<mimetype>;base64,<content>`). */
|
|
129
|
+
base64Url?: string;
|
|
130
|
+
/** @deprecated Ignored by the backend: send the attachment as `base64Url`. */
|
|
131
|
+
fileId?: string;
|
|
132
|
+
};
|
|
109
133
|
export type CreateCampaignPayload = {
|
|
110
134
|
title: string;
|
|
111
135
|
serviceId: string;
|
|
@@ -114,26 +138,94 @@ export type CreateCampaignPayload = {
|
|
|
114
138
|
maxInterval: number | string;
|
|
115
139
|
};
|
|
116
140
|
tagIds?: string[];
|
|
117
|
-
messages?:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}[];
|
|
141
|
+
messages?: CampaignMessageInput[];
|
|
142
|
+
/** On create, replaces the `text` of every message (and is the text of the template message). */
|
|
143
|
+
text?: string;
|
|
121
144
|
isScheduled?: boolean;
|
|
122
145
|
sendsAt?: string | null;
|
|
123
146
|
mustOpenTicket?: boolean;
|
|
124
147
|
defaultDepartmentId?: string | null;
|
|
125
148
|
defaultUserId?: string | null;
|
|
149
|
+
/** @deprecated Ignored by the backend: the contacts come from `tagIds` or the import `fileId`. */
|
|
126
150
|
contacts?: Record<string, string>[];
|
|
151
|
+
/** @deprecated Ignored by the backend: the contacts come from `tagIds` or the import `fileId`. */
|
|
127
152
|
useTags?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* On create, the import file (CSV) of the contacts, uploaded with
|
|
155
|
+
* `attachedType: 'campaign.file'`. The columns are read by `nameField`, `numberField` and
|
|
156
|
+
* `usernameField`.
|
|
157
|
+
*/
|
|
128
158
|
fileId?: string;
|
|
159
|
+
/** On create, stored in `config.nameField` (a `config.nameField` sent here is replaced). */
|
|
129
160
|
nameField?: string;
|
|
161
|
+
/** On create, stored in `config.numberField` (a `config.numberField` sent here is replaced). */
|
|
130
162
|
numberField?: string;
|
|
163
|
+
/** Stored in `config.usernameField` (a `config.usernameField` sent here is replaced). */
|
|
164
|
+
usernameField?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The template to send. On create, the campaign gets one message of it and `messages` is not
|
|
167
|
+
* read.
|
|
168
|
+
*/
|
|
131
169
|
hsm?: WhatsappBusinessTemplate;
|
|
132
170
|
parameters?: CampaignTemplateParameter[];
|
|
171
|
+
/**
|
|
172
|
+
* The header file of the template message (only with `hsm`), already uploaded. Takes precedence
|
|
173
|
+
* over `fileTemplate`.
|
|
174
|
+
*/
|
|
175
|
+
hsmFileId?: string;
|
|
176
|
+
/**
|
|
177
|
+
* The header media of the template message: `base64Url` as a data URL, with its `mimetype`
|
|
178
|
+
* (required on create) and `name`. On create, read only when `tagIds` is sent (an empty array is
|
|
179
|
+
* enough); with the import `fileId`, prefer `hsmFileId`. On update, it only replaces the header
|
|
180
|
+
* file the template message already has: send it only with a new data URL, and leave it out to
|
|
181
|
+
* keep the header.
|
|
182
|
+
*/
|
|
133
183
|
fileTemplate?: CampaignFileTemplate;
|
|
134
184
|
marketingIntegration?: boolean;
|
|
135
185
|
};
|
|
136
|
-
|
|
186
|
+
/**
|
|
187
|
+
* A message of `updateById`. With the `id` of an existing message, the message gets the `text`
|
|
188
|
+
* sent; without `id`, it is created (and `base64Url` is read as in the create).
|
|
189
|
+
*/
|
|
190
|
+
export type UpdateCampaignMessageInput = CampaignMessageInput & {
|
|
191
|
+
id?: string;
|
|
192
|
+
/**
|
|
193
|
+
* On WhatsApp connections, keeps the attachment of an existing message (send the `file` of the
|
|
194
|
+
* message read); with `file`, `base64Url` is not read. Without `file` and `base64Url`, the
|
|
195
|
+
* attachment is removed.
|
|
196
|
+
*/
|
|
197
|
+
file?: unknown;
|
|
198
|
+
/**
|
|
199
|
+
* On WhatsApp connections, the name of the new attachment in `base64Url`: to replace the
|
|
200
|
+
* attachment of an existing message, send `base64Url` with a new name and without `file`.
|
|
201
|
+
*/
|
|
202
|
+
fileName?: string;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* `updateById` (`PUT`). A non-empty `messages` replaces the messages: the ones with the `id` of an
|
|
206
|
+
* existing message update it, the ones without `id` are created and the existing ones left out are
|
|
207
|
+
* deleted (omitted, or `[]`, keeps them).
|
|
208
|
+
*
|
|
209
|
+
* Send `isScheduled` (with `sendsAt`) and `mustOpenTicket` (with `defaultDepartmentId` and
|
|
210
|
+
* `defaultUserId`) on every call: without `isScheduled: true`, `sendsAt` is stored as `null` and a
|
|
211
|
+
* scheduled campaign is no longer started at the date; without `mustOpenTicket: true`, the default
|
|
212
|
+
* department and user are cleared.
|
|
213
|
+
*
|
|
214
|
+
* On WhatsApp Business connections, send the existing message by its `id` (a message without `id`
|
|
215
|
+
* is created without the template), together with `hsm` and `parameters`: every update that sends
|
|
216
|
+
* `messages` or `hsm` rewrites both on the existing messages (a missing one is stored empty).
|
|
217
|
+
*/
|
|
218
|
+
export type UpdateCampaignPayload = Omit<Partial<CreateCampaignPayload>, 'text' | 'usernameField' | 'hsmFileId' | 'messages' | 'config'> & {
|
|
219
|
+
/**
|
|
220
|
+
* Replaces the stored config as a whole. `minInterval` and `maxInterval` go as strings (a number
|
|
221
|
+
* answers 400).
|
|
222
|
+
*/
|
|
223
|
+
config?: {
|
|
224
|
+
minInterval: number | string;
|
|
225
|
+
maxInterval: number | string;
|
|
226
|
+
};
|
|
227
|
+
messages?: UpdateCampaignMessageInput[];
|
|
228
|
+
};
|
|
137
229
|
/** The visible states the `status` filter of `getMany` takes (`'scheduled'` is derived from `isScheduled` + `sendsAt`). */
|
|
138
230
|
export type CampaignListStatus = CampaignStatus | 'scheduled';
|
|
139
231
|
/**
|