@ikatec/digisac-api-sdk 4.16.0 → 4.17.1

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.
@@ -38,7 +38,11 @@ var MessagesApi = class extends require_core_BaseCrudApi.BaseCrudApi {
38
38
  forward(body, headers) {
39
39
  return this.client.post(`${this.basePath}/forward`, body, headers);
40
40
  }
41
- /** Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. */
41
+ /**
42
+ * Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. Resolves `true`, or an empty
43
+ * object on the channels of workers-go (see `RevokeMessageResult`); the message keeps its row, with
44
+ * `data.softRevoked: true`.
45
+ */
42
46
  revoke(id, headers) {
43
47
  return this.client.post(`${this.basePath}/${id}/revoke`, void 0, headers);
44
48
  }
@@ -46,7 +50,10 @@ var MessagesApi = class extends require_core_BaseCrudApi.BaseCrudApi {
46
50
  revokeReaction(id, headers) {
47
51
  return this.client.put(`${this.basePath}/${id}/revoke-reaction`, void 0, headers);
48
52
  }
49
- /** Sends one or more contacts as vCard messages to a given contact. */
53
+ /**
54
+ * Sends one or more contacts as vCard messages to a given contact. Resolves the vCard message on WhatsApp, an empty
55
+ * object on the channels of workers-go and `null` on a channel without vCard (see `SendVcardsResult`).
56
+ */
50
57
  sendVcards(body, headers) {
51
58
  return this.client.post(`${this.basePath}/send-vcards`, body, headers);
52
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MessagesApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/messages/MessagesApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n Message,\n CreateMessagePayload,\n UpdateMessagePayload,\n ForwardMessagesPayload,\n ForwardMessagesResult,\n SendVcardsPayload,\n SendReactionPayload,\n MagicTextPayload,\n MagicTextResult,\n CheckSummaryPayload,\n CheckSummaryResult,\n BulkDestroyPayload,\n OutOfRangeResult,\n LoadAroundQuery,\n} from './types'\n\nexport class MessagesApi extends BaseCrudApi<Message, CreateMessagePayload, UpdateMessagePayload> {\n constructor(client: ApiClient) {\n super(client, '/messages')\n }\n\n /**\n * Edits the text of a message sent by the account, up to 15 minutes after it was sent. Sent as\n * `PATCH /messages/:id`. `contactId` is required: without it the route answers 500, and an\n * unknown or blocked contact answers 400 `The given data was invalid.` (the error comes in\n * `contactId`). So is `text`: `text: ''` alone answers 400 (`At least one field (text or file)\n * must be provided`), and a `text` with only spaces answers 400 `Text cannot be empty`. Only the\n * text is edited: `file` is not sent to the connection. A message received, or sent more than\n * 15 minutes ago, answers 403 `Cannot edit message`; an unknown message answers 404\n * `Message not found`. The message passes to the user who edited it.\n *\n * The message is answered once the edit is sent to the connection, before the connection\n * confirms it: read it again until `text` changes (`data.edited` is set to `true` when the\n * connection reports the edit). On WhatsApp Business and Telegram connections the route answers\n * the result of the edit job, not the message: read it again with `getById`.\n */\n override updateById(\n id: string,\n body: UpdateMessagePayload,\n headers?: Record<string, string>,\n ): Promise<Message> {\n return this.client.patch<Message, UpdateMessagePayload>(`${this.basePath}/${id}`, body, headers)\n }\n\n /**\n * @deprecated Not served: the backend has no DELETE /messages/:id, so this route answers 404.\n * Use {@link bulkDestroy}.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Message> {\n return super.deleteById(id, headers)\n }\n\n /** Forwards one or more messages to one or more contacts (max 20 messages to 5 contacts). */\n forward(\n body: ForwardMessagesPayload,\n headers?: Record<string, string>,\n ): Promise<ForwardMessagesResult> {\n return this.client.post<ForwardMessagesResult, ForwardMessagesPayload>(\n `${this.basePath}/forward`,\n body,\n headers,\n )\n }\n\n /** Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. */\n revoke(id: string, headers?: Record<string, string>): Promise<Message> {\n return this.client.post<Message>(`${this.basePath}/${id}/revoke`, undefined, headers)\n }\n\n /** Removes a previously sent reaction from a message. */\n revokeReaction(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.put<boolean>(`${this.basePath}/${id}/revoke-reaction`, undefined, headers)\n }\n\n /** Sends one or more contacts as vCard messages to a given contact. */\n sendVcards(body: SendVcardsPayload, headers?: Record<string, string>): Promise<Message> {\n return this.client.post<Message, SendVcardsPayload>(\n `${this.basePath}/send-vcards`,\n body,\n headers,\n )\n }\n\n /** Sends an emoji reaction to a message. */\n sendReaction(\n id: string,\n body: SendReactionPayload,\n headers?: Record<string, string>,\n ): Promise<boolean> {\n return this.client.post<boolean, SendReactionPayload>(\n `${this.basePath}/${id}/send-reaction`,\n body,\n headers,\n )\n }\n\n /** Uses AI to rewrite or correct a message text with a given tone (e.g. \"correct\", \"professional\", \"casual\"). */\n magicText(body: MagicTextPayload, headers?: Record<string, string>): Promise<MagicTextResult> {\n return this.client.post<MagicTextResult, MagicTextPayload>(\n `${this.basePath}/magic-text`,\n body,\n headers,\n )\n }\n\n /** Checks whether an AI-generated summary already exists for a given ticket. */\n checkSummary(\n body: CheckSummaryPayload,\n headers?: Record<string, string>,\n ): Promise<CheckSummaryResult> {\n return this.client.post<CheckSummaryResult, CheckSummaryPayload>(\n `${this.basePath}/check-summary`,\n body,\n headers,\n )\n }\n\n /**\n * Deletes multiple messages matching the given where clause.\n * @permissions messages.destroy\n */\n bulkDestroy(body: BulkDestroyPayload, headers?: Record<string, string>): Promise<boolean> {\n return this.client.request<boolean, BulkDestroyPayload>(\n 'DELETE',\n `${this.basePath}/many`,\n body,\n headers,\n )\n }\n\n /**\n * Regenerates an existing AI summary: `id` is the id of the message of `type: 'summary'`. When\n * there is no such message (or the AI limit was reached) nothing is done and it still resolves\n * `'OK'`. To summarize the open ticket of a contact, use `ContactsApi.summarizeTicket`.\n */\n summarize(id: string, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string>(`${this.basePath}/${id}/summarize`, undefined, headers)\n }\n\n /** Checks whether a message is out of the visible range (i.e. there are more than `limit` messages after it). */\n outOfRange(\n id: string,\n limit?: number,\n headers?: Record<string, string>,\n ): Promise<OutOfRangeResult> {\n const queryString = limit ? `?${qs.stringify({ limit })}` : ''\n return this.client.get<OutOfRangeResult>(\n `${this.basePath}/${id}/out-of-range${queryString}`,\n headers,\n )\n }\n\n /**\n * Re-downloads and syncs the file attachment for a message from the messaging service. Resolves\n * what the driver answers; an unknown message answers 500.\n */\n syncFile(id: string, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown>(`${this.basePath}/${id}/sync-file`, undefined, headers)\n }\n\n /** Loads messages surrounding a target message (N before and N after), useful for jumping to a specific point in a conversation. */\n around(\n id: string,\n query?: LoadAroundQuery,\n headers?: Record<string, string>,\n ): Promise<Message[]> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<Message[]>(`${this.basePath}/${id}/around${queryString}`, headers)\n }\n}\n"],"mappings":";;;;;;;AAoBA,IAAa,cAAb,cAAiCA,qCAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;;;;;;;;;;;;CAkB5B,AAAS,WACP,IACA,MACA,SACkB;AAClB,SAAO,KAAK,OAAO,MAAqC,GAAG,KAAK,SAAS,GAAG,MAAM,MAAM,QAAQ;;;;;;CAOlG,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;CAItC,QACE,MACA,SACgC;AAChC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,WACjB,MACA,QACD;;;CAIH,OAAO,IAAY,SAAoD;AACrE,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,UAAU,QAAW,QAAQ;;;CAIvF,eAAe,IAAY,SAAoD;AAC7E,SAAO,KAAK,OAAO,IAAa,GAAG,KAAK,SAAS,GAAG,GAAG,mBAAmB,QAAW,QAAQ;;;CAI/F,WAAW,MAAyB,SAAoD;AACtF,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,eACjB,MACA,QACD;;;CAIH,aACE,IACA,MACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,iBACvB,MACA,QACD;;;CAIH,UAAU,MAAwB,SAA4D;AAC5F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,cACjB,MACA,QACD;;;CAIH,aACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,iBACjB,MACA,QACD;;;;;;CAOH,YAAY,MAA0B,SAAoD;AACxF,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,UAAU,IAAY,SAAmD;AACvE,SAAO,KAAK,OAAO,KAAa,GAAG,KAAK,SAAS,GAAG,GAAG,aAAa,QAAW,QAAQ;;;CAIzF,WACE,IACA,OACA,SAC2B;EAC3B,MAAM,cAAc,QAAQ,IAAI,WAAG,UAAU,EAAE,OAAO,CAAC,KAAK;AAC5D,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,GAAG,GAAG,eAAe,eACtC,QACD;;;;;;CAOH,SAAS,IAAY,SAAoD;AACvE,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,aAAa,QAAW,QAAQ;;;CAI1F,OACE,IACA,OACA,SACoB;EACpB,MAAM,cAAc,QAAQ,IAAI,WAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IAAe,GAAG,KAAK,SAAS,GAAG,GAAG,SAAS,eAAe,QAAQ"}
1
+ {"version":3,"file":"MessagesApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/messages/MessagesApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n Message,\n CreateMessagePayload,\n UpdateMessagePayload,\n ForwardMessagesPayload,\n ForwardMessagesResult,\n SendVcardsPayload,\n SendVcardsResult,\n RevokeMessageResult,\n SendReactionPayload,\n MagicTextPayload,\n MagicTextResult,\n CheckSummaryPayload,\n CheckSummaryResult,\n BulkDestroyPayload,\n OutOfRangeResult,\n LoadAroundQuery,\n} from './types'\n\nexport class MessagesApi extends BaseCrudApi<Message, CreateMessagePayload, UpdateMessagePayload> {\n constructor(client: ApiClient) {\n super(client, '/messages')\n }\n\n /**\n * Edits the text of a message sent by the account, up to 15 minutes after it was sent. Sent as\n * `PATCH /messages/:id`. `contactId` is required: without it the route answers 500, and an\n * unknown or blocked contact answers 400 `The given data was invalid.` (the error comes in\n * `contactId`). So is `text`: `text: ''` alone answers 400 (`At least one field (text or file)\n * must be provided`), and a `text` with only spaces answers 400 `Text cannot be empty`. Only the\n * text is edited: `file` is not sent to the connection. A message received, or sent more than\n * 15 minutes ago, answers 403 `Cannot edit message`; an unknown message answers 404\n * `Message not found`. The message passes to the user who edited it.\n *\n * The message is answered once the edit is sent to the connection, before the connection\n * confirms it: read it again until `text` changes (`data.edited` is set to `true` when the\n * connection reports the edit). On WhatsApp Business and Telegram connections the route answers\n * the result of the edit job, not the message: read it again with `getById`.\n */\n override updateById(\n id: string,\n body: UpdateMessagePayload,\n headers?: Record<string, string>,\n ): Promise<Message> {\n return this.client.patch<Message, UpdateMessagePayload>(`${this.basePath}/${id}`, body, headers)\n }\n\n /**\n * @deprecated Not served: the backend has no DELETE /messages/:id, so this route answers 404.\n * Use {@link bulkDestroy}.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Message> {\n return super.deleteById(id, headers)\n }\n\n /** Forwards one or more messages to one or more contacts (max 20 messages to 5 contacts). */\n forward(\n body: ForwardMessagesPayload,\n headers?: Record<string, string>,\n ): Promise<ForwardMessagesResult> {\n return this.client.post<ForwardMessagesResult, ForwardMessagesPayload>(\n `${this.basePath}/forward`,\n body,\n headers,\n )\n }\n\n /**\n * Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. Resolves `true`, or an empty\n * object on the channels of workers-go (see `RevokeMessageResult`); the message keeps its row, with\n * `data.softRevoked: true`.\n */\n revoke(id: string, headers?: Record<string, string>): Promise<RevokeMessageResult> {\n return this.client.post<RevokeMessageResult>(\n `${this.basePath}/${id}/revoke`,\n undefined,\n headers,\n )\n }\n\n /** Removes a previously sent reaction from a message. */\n revokeReaction(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.put<boolean>(`${this.basePath}/${id}/revoke-reaction`, undefined, headers)\n }\n\n /**\n * Sends one or more contacts as vCard messages to a given contact. Resolves the vCard message on WhatsApp, an empty\n * object on the channels of workers-go and `null` on a channel without vCard (see `SendVcardsResult`).\n */\n sendVcards(body: SendVcardsPayload, headers?: Record<string, string>): Promise<SendVcardsResult> {\n return this.client.post<SendVcardsResult, SendVcardsPayload>(\n `${this.basePath}/send-vcards`,\n body,\n headers,\n )\n }\n\n /** Sends an emoji reaction to a message. */\n sendReaction(\n id: string,\n body: SendReactionPayload,\n headers?: Record<string, string>,\n ): Promise<boolean> {\n return this.client.post<boolean, SendReactionPayload>(\n `${this.basePath}/${id}/send-reaction`,\n body,\n headers,\n )\n }\n\n /** Uses AI to rewrite or correct a message text with a given tone (e.g. \"correct\", \"professional\", \"casual\"). */\n magicText(body: MagicTextPayload, headers?: Record<string, string>): Promise<MagicTextResult> {\n return this.client.post<MagicTextResult, MagicTextPayload>(\n `${this.basePath}/magic-text`,\n body,\n headers,\n )\n }\n\n /** Checks whether an AI-generated summary already exists for a given ticket. */\n checkSummary(\n body: CheckSummaryPayload,\n headers?: Record<string, string>,\n ): Promise<CheckSummaryResult> {\n return this.client.post<CheckSummaryResult, CheckSummaryPayload>(\n `${this.basePath}/check-summary`,\n body,\n headers,\n )\n }\n\n /**\n * Deletes multiple messages matching the given where clause.\n * @permissions messages.destroy\n */\n bulkDestroy(body: BulkDestroyPayload, headers?: Record<string, string>): Promise<boolean> {\n return this.client.request<boolean, BulkDestroyPayload>(\n 'DELETE',\n `${this.basePath}/many`,\n body,\n headers,\n )\n }\n\n /**\n * Regenerates an existing AI summary: `id` is the id of the message of `type: 'summary'`. When\n * there is no such message (or the AI limit was reached) nothing is done and it still resolves\n * `'OK'`. To summarize the open ticket of a contact, use `ContactsApi.summarizeTicket`.\n */\n summarize(id: string, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string>(`${this.basePath}/${id}/summarize`, undefined, headers)\n }\n\n /** Checks whether a message is out of the visible range (i.e. there are more than `limit` messages after it). */\n outOfRange(\n id: string,\n limit?: number,\n headers?: Record<string, string>,\n ): Promise<OutOfRangeResult> {\n const queryString = limit ? `?${qs.stringify({ limit })}` : ''\n return this.client.get<OutOfRangeResult>(\n `${this.basePath}/${id}/out-of-range${queryString}`,\n headers,\n )\n }\n\n /**\n * Re-downloads and syncs the file attachment for a message from the messaging service. Resolves\n * what the driver answers; an unknown message answers 500.\n */\n syncFile(id: string, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown>(`${this.basePath}/${id}/sync-file`, undefined, headers)\n }\n\n /** Loads messages surrounding a target message (N before and N after), useful for jumping to a specific point in a conversation. */\n around(\n id: string,\n query?: LoadAroundQuery,\n headers?: Record<string, string>,\n ): Promise<Message[]> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<Message[]>(`${this.basePath}/${id}/around${queryString}`, headers)\n }\n}\n"],"mappings":";;;;;;;AAsBA,IAAa,cAAb,cAAiCA,qCAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;;;;;;;;;;;;CAkB5B,AAAS,WACP,IACA,MACA,SACkB;AAClB,SAAO,KAAK,OAAO,MAAqC,GAAG,KAAK,SAAS,GAAG,MAAM,MAAM,QAAQ;;;;;;CAOlG,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;CAItC,QACE,MACA,SACgC;AAChC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,WACjB,MACA,QACD;;;;;;;CAQH,OAAO,IAAY,SAAgE;AACjF,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,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core/ApiClient';
2
2
  import { BaseCrudApi } from '../../core/BaseCrudApi';
3
- import type { Message, CreateMessagePayload, UpdateMessagePayload, ForwardMessagesPayload, ForwardMessagesResult, SendVcardsPayload, SendReactionPayload, MagicTextPayload, MagicTextResult, CheckSummaryPayload, CheckSummaryResult, BulkDestroyPayload, OutOfRangeResult, LoadAroundQuery } from './types';
3
+ import type { Message, CreateMessagePayload, UpdateMessagePayload, ForwardMessagesPayload, ForwardMessagesResult, SendVcardsPayload, SendVcardsResult, RevokeMessageResult, SendReactionPayload, MagicTextPayload, MagicTextResult, CheckSummaryPayload, CheckSummaryResult, BulkDestroyPayload, OutOfRangeResult, LoadAroundQuery } from './types';
4
4
  export declare class MessagesApi extends BaseCrudApi<Message, CreateMessagePayload, UpdateMessagePayload> {
5
5
  constructor(client: ApiClient);
6
6
  /**
@@ -26,12 +26,19 @@ export declare class MessagesApi extends BaseCrudApi<Message, CreateMessagePaylo
26
26
  deleteById(id: string, headers?: Record<string, string>): Promise<Message>;
27
27
  /** Forwards one or more messages to one or more contacts (max 20 messages to 5 contacts). */
28
28
  forward(body: ForwardMessagesPayload, headers?: Record<string, string>): Promise<ForwardMessagesResult>;
29
- /** Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. */
30
- revoke(id: string, headers?: Record<string, string>): Promise<Message>;
29
+ /**
30
+ * Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. Resolves `true`, or an empty
31
+ * object on the channels of workers-go (see `RevokeMessageResult`); the message keeps its row, with
32
+ * `data.softRevoked: true`.
33
+ */
34
+ revoke(id: string, headers?: Record<string, string>): Promise<RevokeMessageResult>;
31
35
  /** Removes a previously sent reaction from a message. */
32
36
  revokeReaction(id: string, headers?: Record<string, string>): Promise<boolean>;
33
- /** Sends one or more contacts as vCard messages to a given contact. */
34
- sendVcards(body: SendVcardsPayload, headers?: Record<string, string>): Promise<Message>;
37
+ /**
38
+ * Sends one or more contacts as vCard messages to a given contact. Resolves the vCard message on WhatsApp, an empty
39
+ * object on the channels of workers-go and `null` on a channel without vCard (see `SendVcardsResult`).
40
+ */
41
+ sendVcards(body: SendVcardsPayload, headers?: Record<string, string>): Promise<SendVcardsResult>;
35
42
  /** Sends an emoji reaction to a message. */
36
43
  sendReaction(id: string, body: SendReactionPayload, headers?: Record<string, string>): Promise<boolean>;
37
44
  /** Uses AI to rewrite or correct a message text with a given tone (e.g. "correct", "professional", "casual"). */
@@ -1 +1 @@
1
- {"version":3,"file":"MessagesApi.d.ts","sourceRoot":"","sources":["../../../src/apis/messages/MessagesApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,qBAAa,WAAY,SAAQ,WAAW,CAAC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,CAAC;gBACnF,MAAM,EAAE,SAAS;IAI7B;;;;;;;;;;;;;;OAcG;IACM,UAAU,CACjB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC;IAInB;;;OAGG;IACM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAInF,6FAA6F;IAC7F,OAAO,CACL,IAAI,EAAE,sBAAsB,EAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA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AAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IASzF;;;;OAIG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxE,iHAAiH;IACjH,UAAU,CACR,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,gBAAgB,CAAC;IAQ5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxE,oIAAoI;IACpI,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,OAAO,EAAE,CAAC;CAItB"}
@@ -35,7 +35,11 @@ var MessagesApi = class extends BaseCrudApi {
35
35
  forward(body, headers) {
36
36
  return this.client.post(`${this.basePath}/forward`, body, headers);
37
37
  }
38
- /** Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. */
38
+ /**
39
+ * Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. Resolves `true`, or an empty
40
+ * object on the channels of workers-go (see `RevokeMessageResult`); the message keeps its row, with
41
+ * `data.softRevoked: true`.
42
+ */
39
43
  revoke(id, headers) {
40
44
  return this.client.post(`${this.basePath}/${id}/revoke`, void 0, headers);
41
45
  }
@@ -43,7 +47,10 @@ var MessagesApi = class extends BaseCrudApi {
43
47
  revokeReaction(id, headers) {
44
48
  return this.client.put(`${this.basePath}/${id}/revoke-reaction`, void 0, headers);
45
49
  }
46
- /** Sends one or more contacts as vCard messages to a given contact. */
50
+ /**
51
+ * Sends one or more contacts as vCard messages to a given contact. Resolves the vCard message on WhatsApp, an empty
52
+ * object on the channels of workers-go and `null` on a channel without vCard (see `SendVcardsResult`).
53
+ */
47
54
  sendVcards(body, headers) {
48
55
  return this.client.post(`${this.basePath}/send-vcards`, body, headers);
49
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MessagesApi.mjs","names":[],"sources":["../../../src/apis/messages/MessagesApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n Message,\n CreateMessagePayload,\n UpdateMessagePayload,\n ForwardMessagesPayload,\n ForwardMessagesResult,\n SendVcardsPayload,\n SendReactionPayload,\n MagicTextPayload,\n MagicTextResult,\n CheckSummaryPayload,\n CheckSummaryResult,\n BulkDestroyPayload,\n OutOfRangeResult,\n LoadAroundQuery,\n} from './types'\n\nexport class MessagesApi extends BaseCrudApi<Message, CreateMessagePayload, UpdateMessagePayload> {\n constructor(client: ApiClient) {\n super(client, '/messages')\n }\n\n /**\n * Edits the text of a message sent by the account, up to 15 minutes after it was sent. Sent as\n * `PATCH /messages/:id`. `contactId` is required: without it the route answers 500, and an\n * unknown or blocked contact answers 400 `The given data was invalid.` (the error comes in\n * `contactId`). So is `text`: `text: ''` alone answers 400 (`At least one field (text or file)\n * must be provided`), and a `text` with only spaces answers 400 `Text cannot be empty`. Only the\n * text is edited: `file` is not sent to the connection. A message received, or sent more than\n * 15 minutes ago, answers 403 `Cannot edit message`; an unknown message answers 404\n * `Message not found`. The message passes to the user who edited it.\n *\n * The message is answered once the edit is sent to the connection, before the connection\n * confirms it: read it again until `text` changes (`data.edited` is set to `true` when the\n * connection reports the edit). On WhatsApp Business and Telegram connections the route answers\n * the result of the edit job, not the message: read it again with `getById`.\n */\n override updateById(\n id: string,\n body: UpdateMessagePayload,\n headers?: Record<string, string>,\n ): Promise<Message> {\n return this.client.patch<Message, UpdateMessagePayload>(`${this.basePath}/${id}`, body, headers)\n }\n\n /**\n * @deprecated Not served: the backend has no DELETE /messages/:id, so this route answers 404.\n * Use {@link bulkDestroy}.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Message> {\n return super.deleteById(id, headers)\n }\n\n /** Forwards one or more messages to one or more contacts (max 20 messages to 5 contacts). */\n forward(\n body: ForwardMessagesPayload,\n headers?: Record<string, string>,\n ): Promise<ForwardMessagesResult> {\n return this.client.post<ForwardMessagesResult, ForwardMessagesPayload>(\n `${this.basePath}/forward`,\n body,\n headers,\n )\n }\n\n /** Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. */\n revoke(id: string, headers?: Record<string, string>): Promise<Message> {\n return this.client.post<Message>(`${this.basePath}/${id}/revoke`, undefined, headers)\n }\n\n /** Removes a previously sent reaction from a message. */\n revokeReaction(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.put<boolean>(`${this.basePath}/${id}/revoke-reaction`, undefined, headers)\n }\n\n /** Sends one or more contacts as vCard messages to a given contact. */\n sendVcards(body: SendVcardsPayload, headers?: Record<string, string>): Promise<Message> {\n return this.client.post<Message, SendVcardsPayload>(\n `${this.basePath}/send-vcards`,\n body,\n headers,\n )\n }\n\n /** Sends an emoji reaction to a message. */\n sendReaction(\n id: string,\n body: SendReactionPayload,\n headers?: Record<string, string>,\n ): Promise<boolean> {\n return this.client.post<boolean, SendReactionPayload>(\n `${this.basePath}/${id}/send-reaction`,\n body,\n headers,\n )\n }\n\n /** Uses AI to rewrite or correct a message text with a given tone (e.g. \"correct\", \"professional\", \"casual\"). */\n magicText(body: MagicTextPayload, headers?: Record<string, string>): Promise<MagicTextResult> {\n return this.client.post<MagicTextResult, MagicTextPayload>(\n `${this.basePath}/magic-text`,\n body,\n headers,\n )\n }\n\n /** Checks whether an AI-generated summary already exists for a given ticket. */\n checkSummary(\n body: CheckSummaryPayload,\n headers?: Record<string, string>,\n ): Promise<CheckSummaryResult> {\n return this.client.post<CheckSummaryResult, CheckSummaryPayload>(\n `${this.basePath}/check-summary`,\n body,\n headers,\n )\n }\n\n /**\n * Deletes multiple messages matching the given where clause.\n * @permissions messages.destroy\n */\n bulkDestroy(body: BulkDestroyPayload, headers?: Record<string, string>): Promise<boolean> {\n return this.client.request<boolean, BulkDestroyPayload>(\n 'DELETE',\n `${this.basePath}/many`,\n body,\n headers,\n )\n }\n\n /**\n * Regenerates an existing AI summary: `id` is the id of the message of `type: 'summary'`. When\n * there is no such message (or the AI limit was reached) nothing is done and it still resolves\n * `'OK'`. To summarize the open ticket of a contact, use `ContactsApi.summarizeTicket`.\n */\n summarize(id: string, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string>(`${this.basePath}/${id}/summarize`, undefined, headers)\n }\n\n /** Checks whether a message is out of the visible range (i.e. there are more than `limit` messages after it). */\n outOfRange(\n id: string,\n limit?: number,\n headers?: Record<string, string>,\n ): Promise<OutOfRangeResult> {\n const queryString = limit ? `?${qs.stringify({ limit })}` : ''\n return this.client.get<OutOfRangeResult>(\n `${this.basePath}/${id}/out-of-range${queryString}`,\n headers,\n )\n }\n\n /**\n * Re-downloads and syncs the file attachment for a message from the messaging service. Resolves\n * what the driver answers; an unknown message answers 500.\n */\n syncFile(id: string, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown>(`${this.basePath}/${id}/sync-file`, undefined, headers)\n }\n\n /** Loads messages surrounding a target message (N before and N after), useful for jumping to a specific point in a conversation. */\n around(\n id: string,\n query?: LoadAroundQuery,\n headers?: Record<string, string>,\n ): Promise<Message[]> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<Message[]>(`${this.basePath}/${id}/around${queryString}`, headers)\n }\n}\n"],"mappings":";;;;AAoBA,IAAa,cAAb,cAAiC,YAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;;;;;;;;;;;;CAkB5B,AAAS,WACP,IACA,MACA,SACkB;AAClB,SAAO,KAAK,OAAO,MAAqC,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;AACvE,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,aAAa,QAAW,QAAQ;;;CAI1F,OACE,IACA,OACA,SACoB;EACpB,MAAM,cAAc,QAAQ,IAAI,GAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IAAe,GAAG,KAAK,SAAS,GAAG,GAAG,SAAS,eAAe,QAAQ"}
1
+ {"version":3,"file":"MessagesApi.mjs","names":[],"sources":["../../../src/apis/messages/MessagesApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n Message,\n CreateMessagePayload,\n UpdateMessagePayload,\n ForwardMessagesPayload,\n ForwardMessagesResult,\n SendVcardsPayload,\n SendVcardsResult,\n RevokeMessageResult,\n SendReactionPayload,\n MagicTextPayload,\n MagicTextResult,\n CheckSummaryPayload,\n CheckSummaryResult,\n BulkDestroyPayload,\n OutOfRangeResult,\n LoadAroundQuery,\n} from './types'\n\nexport class MessagesApi extends BaseCrudApi<Message, CreateMessagePayload, UpdateMessagePayload> {\n constructor(client: ApiClient) {\n super(client, '/messages')\n }\n\n /**\n * Edits the text of a message sent by the account, up to 15 minutes after it was sent. Sent as\n * `PATCH /messages/:id`. `contactId` is required: without it the route answers 500, and an\n * unknown or blocked contact answers 400 `The given data was invalid.` (the error comes in\n * `contactId`). So is `text`: `text: ''` alone answers 400 (`At least one field (text or file)\n * must be provided`), and a `text` with only spaces answers 400 `Text cannot be empty`. Only the\n * text is edited: `file` is not sent to the connection. A message received, or sent more than\n * 15 minutes ago, answers 403 `Cannot edit message`; an unknown message answers 404\n * `Message not found`. The message passes to the user who edited it.\n *\n * The message is answered once the edit is sent to the connection, before the connection\n * confirms it: read it again until `text` changes (`data.edited` is set to `true` when the\n * connection reports the edit). On WhatsApp Business and Telegram connections the route answers\n * the result of the edit job, not the message: read it again with `getById`.\n */\n override updateById(\n id: string,\n body: UpdateMessagePayload,\n headers?: Record<string, string>,\n ): Promise<Message> {\n return this.client.patch<Message, UpdateMessagePayload>(`${this.basePath}/${id}`, body, headers)\n }\n\n /**\n * @deprecated Not served: the backend has no DELETE /messages/:id, so this route answers 404.\n * Use {@link bulkDestroy}.\n */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Message> {\n return super.deleteById(id, headers)\n }\n\n /** Forwards one or more messages to one or more contacts (max 20 messages to 5 contacts). */\n forward(\n body: ForwardMessagesPayload,\n headers?: Record<string, string>,\n ): Promise<ForwardMessagesResult> {\n return this.client.post<ForwardMessagesResult, ForwardMessagesPayload>(\n `${this.basePath}/forward`,\n body,\n headers,\n )\n }\n\n /**\n * Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. Resolves `true`, or an empty\n * object on the channels of workers-go (see `RevokeMessageResult`); the message keeps its row, with\n * `data.softRevoked: true`.\n */\n revoke(id: string, headers?: Record<string, string>): Promise<RevokeMessageResult> {\n return this.client.post<RevokeMessageResult>(\n `${this.basePath}/${id}/revoke`,\n undefined,\n headers,\n )\n }\n\n /** Removes a previously sent reaction from a message. */\n revokeReaction(id: string, headers?: Record<string, string>): Promise<boolean> {\n return this.client.put<boolean>(`${this.basePath}/${id}/revoke-reaction`, undefined, headers)\n }\n\n /**\n * Sends one or more contacts as vCard messages to a given contact. Resolves the vCard message on WhatsApp, an empty\n * object on the channels of workers-go and `null` on a channel without vCard (see `SendVcardsResult`).\n */\n sendVcards(body: SendVcardsPayload, headers?: Record<string, string>): Promise<SendVcardsResult> {\n return this.client.post<SendVcardsResult, SendVcardsPayload>(\n `${this.basePath}/send-vcards`,\n body,\n headers,\n )\n }\n\n /** Sends an emoji reaction to a message. */\n sendReaction(\n id: string,\n body: SendReactionPayload,\n headers?: Record<string, string>,\n ): Promise<boolean> {\n return this.client.post<boolean, SendReactionPayload>(\n `${this.basePath}/${id}/send-reaction`,\n body,\n headers,\n )\n }\n\n /** Uses AI to rewrite or correct a message text with a given tone (e.g. \"correct\", \"professional\", \"casual\"). */\n magicText(body: MagicTextPayload, headers?: Record<string, string>): Promise<MagicTextResult> {\n return this.client.post<MagicTextResult, MagicTextPayload>(\n `${this.basePath}/magic-text`,\n body,\n headers,\n )\n }\n\n /** Checks whether an AI-generated summary already exists for a given ticket. */\n checkSummary(\n body: CheckSummaryPayload,\n headers?: Record<string, string>,\n ): Promise<CheckSummaryResult> {\n return this.client.post<CheckSummaryResult, CheckSummaryPayload>(\n `${this.basePath}/check-summary`,\n body,\n headers,\n )\n }\n\n /**\n * Deletes multiple messages matching the given where clause.\n * @permissions messages.destroy\n */\n bulkDestroy(body: BulkDestroyPayload, headers?: Record<string, string>): Promise<boolean> {\n return this.client.request<boolean, BulkDestroyPayload>(\n 'DELETE',\n `${this.basePath}/many`,\n body,\n headers,\n )\n }\n\n /**\n * Regenerates an existing AI summary: `id` is the id of the message of `type: 'summary'`. When\n * there is no such message (or the AI limit was reached) nothing is done and it still resolves\n * `'OK'`. To summarize the open ticket of a contact, use `ContactsApi.summarizeTicket`.\n */\n summarize(id: string, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string>(`${this.basePath}/${id}/summarize`, undefined, headers)\n }\n\n /** Checks whether a message is out of the visible range (i.e. there are more than `limit` messages after it). */\n outOfRange(\n id: string,\n limit?: number,\n headers?: Record<string, string>,\n ): Promise<OutOfRangeResult> {\n const queryString = limit ? `?${qs.stringify({ limit })}` : ''\n return this.client.get<OutOfRangeResult>(\n `${this.basePath}/${id}/out-of-range${queryString}`,\n headers,\n )\n }\n\n /**\n * Re-downloads and syncs the file attachment for a message from the messaging service. Resolves\n * what the driver answers; an unknown message answers 500.\n */\n syncFile(id: string, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown>(`${this.basePath}/${id}/sync-file`, undefined, headers)\n }\n\n /** Loads messages surrounding a target message (N before and N after), useful for jumping to a specific point in a conversation. */\n around(\n id: string,\n query?: LoadAroundQuery,\n headers?: Record<string, string>,\n ): Promise<Message[]> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<Message[]>(`${this.basePath}/${id}/around${queryString}`, headers)\n }\n}\n"],"mappings":";;;;AAsBA,IAAa,cAAb,cAAiC,YAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;;;;;;;;;;;;CAkB5B,AAAS,WACP,IACA,MACA,SACkB;AAClB,SAAO,KAAK,OAAO,MAAqC,GAAG,KAAK,SAAS,GAAG,MAAM,MAAM,QAAQ;;;;;;CAOlG,AAAS,WAAW,IAAY,SAAoD;AAClF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;CAItC,QACE,MACA,SACgC;AAChC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,WACjB,MACA,QACD;;;;;;;CAQH,OAAO,IAAY,SAAgE;AACjF,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,UACvB,QACA,QACD;;;CAIH,eAAe,IAAY,SAAoD;AAC7E,SAAO,KAAK,OAAO,IAAa,GAAG,KAAK,SAAS,GAAG,GAAG,mBAAmB,QAAW,QAAQ;;;;;;CAO/F,WAAW,MAAyB,SAA6D;AAC/F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,eACjB,MACA,QACD;;;CAIH,aACE,IACA,MACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,iBACvB,MACA,QACD;;;CAIH,UAAU,MAAwB,SAA4D;AAC5F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,cACjB,MACA,QACD;;;CAIH,aACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,iBACjB,MACA,QACD;;;;;;CAOH,YAAY,MAA0B,SAAoD;AACxF,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,UAAU,IAAY,SAAmD;AACvE,SAAO,KAAK,OAAO,KAAa,GAAG,KAAK,SAAS,GAAG,GAAG,aAAa,QAAW,QAAQ;;;CAIzF,WACE,IACA,OACA,SAC2B;EAC3B,MAAM,cAAc,QAAQ,IAAI,GAAG,UAAU,EAAE,OAAO,CAAC,KAAK;AAC5D,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,GAAG,GAAG,eAAe,eACtC,QACD;;;;;;CAOH,SAAS,IAAY,SAAoD;AACvE,SAAO,KAAK,OAAO,KAAc,GAAG,KAAK,SAAS,GAAG,GAAG,aAAa,QAAW,QAAQ;;;CAI1F,OACE,IACA,OACA,SACoB;EACpB,MAAM,cAAc,QAAQ,IAAI,GAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IAAe,GAAG,KAAK,SAAS,GAAG,GAAG,SAAS,eAAe,QAAQ"}
@@ -139,15 +139,26 @@ export type Message = {
139
139
  };
140
140
  };
141
141
  export type MessageRelationships = 'user' | 'from' | 'contact' | 'ticket' | 'file' | 'files' | 'thumbnail' | 'preview' | 'quotedMessage' | 'ticketUser' | 'ticketDepartment' | 'hsm' | 'hsmFile' | 'reactions' | 'reactionParentMessage' | 'mentionedList' | 'interpolatedHsmMessage';
142
+ /** A file sent inline in a message. `base64` may also be a `data:` URL, which carries the mimetype. */
143
+ export type MessageFileInput = {
144
+ base64: string;
145
+ mimetype: string;
146
+ name: string;
147
+ };
142
148
  export type CreateMessagePayload = {
143
149
  text?: string;
144
150
  contactId?: string;
145
151
  number?: string;
152
+ /** Name of the contact created when the message is sent by `number`. */
153
+ name?: string;
146
154
  serviceId?: string;
147
155
  userId?: string;
156
+ /** The file sent with the message, usually a {@link MessageFileInput}; `text` goes as its caption. */
148
157
  file?: unknown;
149
158
  fileId?: string;
150
159
  filesIds?: string[];
160
+ /** Files attached to an e-mail. The other connections send a single `file`. */
161
+ attachments?: MessageFileInput[];
151
162
  quotedMessageId?: string;
152
163
  hsmId?: string;
153
164
  hsm?: unknown;
@@ -160,7 +171,21 @@ export type CreateMessagePayload = {
160
171
  mentionedList?: string[];
161
172
  interactiveMessage?: unknown;
162
173
  stickerId?: string;
174
+ /**
175
+ * Sends an audio as a voice note. When omitted the audio is converted as a voice note (the
176
+ * backend defaults it to `true` on the conversion).
177
+ */
163
178
  isPtt?: boolean;
179
+ /** Sends the file as a document, keeping its original format (audio is not converted). */
180
+ sendAsDocument?: boolean;
181
+ /** Template parameters of a WhatsApp Business HSM. */
182
+ parameters?: unknown;
183
+ /** Header media of a WhatsApp Business HSM. */
184
+ fileTemplate?: MessageFileInput;
185
+ /** Contact card sent by a WhatsApp Business connection. Other connections use `sendVcards`. */
186
+ vcard?: unknown;
187
+ /** Actions shown by the webchat widget. */
188
+ actions?: unknown;
164
189
  subject?: string;
165
190
  ccs?: unknown[];
166
191
  };
@@ -190,6 +215,18 @@ export type SendVcardsPayload = {
190
215
  contactId: string;
191
216
  contactsIds: string[];
192
217
  };
218
+ /**
219
+ * What `POST /messages/{id}/revoke` answers, by channel: `true` on the channels the API drives itself (WhatsApp and the
220
+ * channels whose adapter has no revoke), and an empty object on the channels of workers-go (e.g. Telegram), which answer
221
+ * the result of the revoke job. Read `data.softRevoked` of the message for the effect.
222
+ */
223
+ export type RevokeMessageResult = boolean | Record<string, never>;
224
+ /**
225
+ * What `POST /messages/send-vcards` answers, by channel: the vCard message on WhatsApp, an empty object on the channels
226
+ * of workers-go (e.g. Telegram), which answer the result of the send job, and `null` on a channel without vCard (e.g.
227
+ * Webchat, SMS), where nothing is sent.
228
+ */
229
+ export type SendVcardsResult = Message | Record<string, never> | null;
193
230
  export type SendReactionPayload = {
194
231
  reactionEmojiRendered: string;
195
232
  reactionCode?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/messages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK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4.17.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -220,14 +220,19 @@ describe('MessagesApi', () => {
220
220
 
221
221
  describe('revoke', () => {
222
222
  it('calls client.post with /messages/:id/revoke', async () => {
223
- vi.mocked(client.post).mockResolvedValue(message)
223
+ vi.mocked(client.post).mockResolvedValue(true)
224
224
  const result = await api.revoke('msg-1')
225
225
  expect(client.post).toHaveBeenCalledWith('/messages/msg-1/revoke', undefined, undefined)
226
- expect(result).toEqual(message)
226
+ expect(result).toBe(true)
227
+ })
228
+
229
+ it('resolves the empty object the channels of workers-go answer', async () => {
230
+ vi.mocked(client.post).mockResolvedValue({})
231
+ await expect(api.revoke('msg-1')).resolves.toEqual({})
227
232
  })
228
233
 
229
234
  it('forwards custom headers', async () => {
230
- vi.mocked(client.post).mockResolvedValue(message)
235
+ vi.mocked(client.post).mockResolvedValue(true)
231
236
  const headers = { 'X-Custom': 'h' }
232
237
  await api.revoke('msg-1', headers)
233
238
  expect(client.post).toHaveBeenCalledWith('/messages/msg-1/revoke', undefined, headers)
@@ -267,6 +272,15 @@ describe('MessagesApi', () => {
267
272
  expect(result).toEqual(message)
268
273
  })
269
274
 
275
+ it.each([
276
+ ['the empty object of the channels of workers-go', {}],
277
+ ['null on a channel without vCard', null],
278
+ ])('resolves %s', async (_label, answer) => {
279
+ vi.mocked(client.post).mockResolvedValue(answer)
280
+ const body: SendVcardsPayload = { serviceId: 's-1', contactId: 'c-1', contactsIds: ['c-2'] }
281
+ await expect(api.sendVcards(body)).resolves.toEqual(answer)
282
+ })
283
+
270
284
  it('forwards custom headers', async () => {
271
285
  vi.mocked(client.post).mockResolvedValue(message)
272
286
  const headers = { 'X-Custom': 'h' }
@@ -8,6 +8,8 @@ import type {
8
8
  ForwardMessagesPayload,
9
9
  ForwardMessagesResult,
10
10
  SendVcardsPayload,
11
+ SendVcardsResult,
12
+ RevokeMessageResult,
11
13
  SendReactionPayload,
12
14
  MagicTextPayload,
13
15
  MagicTextResult,
@@ -66,9 +68,17 @@ export class MessagesApi extends BaseCrudApi<Message, CreateMessagePayload, Upda
66
68
  )
67
69
  }
68
70
 
69
- /** Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. */
70
- revoke(id: string, headers?: Record<string, string>): Promise<Message> {
71
- return this.client.post<Message>(`${this.basePath}/${id}/revoke`, undefined, headers)
71
+ /**
72
+ * Revokes (soft-deletes) a sent message so it is no longer visible to the recipient. Resolves `true`, or an empty
73
+ * object on the channels of workers-go (see `RevokeMessageResult`); the message keeps its row, with
74
+ * `data.softRevoked: true`.
75
+ */
76
+ revoke(id: string, headers?: Record<string, string>): Promise<RevokeMessageResult> {
77
+ return this.client.post<RevokeMessageResult>(
78
+ `${this.basePath}/${id}/revoke`,
79
+ undefined,
80
+ headers,
81
+ )
72
82
  }
73
83
 
74
84
  /** Removes a previously sent reaction from a message. */
@@ -76,9 +86,12 @@ export class MessagesApi extends BaseCrudApi<Message, CreateMessagePayload, Upda
76
86
  return this.client.put<boolean>(`${this.basePath}/${id}/revoke-reaction`, undefined, headers)
77
87
  }
78
88
 
79
- /** Sends one or more contacts as vCard messages to a given contact. */
80
- sendVcards(body: SendVcardsPayload, headers?: Record<string, string>): Promise<Message> {
81
- return this.client.post<Message, SendVcardsPayload>(
89
+ /**
90
+ * Sends one or more contacts as vCard messages to a given contact. Resolves the vCard message on WhatsApp, an empty
91
+ * object on the channels of workers-go and `null` on a channel without vCard (see `SendVcardsResult`).
92
+ */
93
+ sendVcards(body: SendVcardsPayload, headers?: Record<string, string>): Promise<SendVcardsResult> {
94
+ return this.client.post<SendVcardsResult, SendVcardsPayload>(
82
95
  `${this.basePath}/send-vcards`,
83
96
  body,
84
97
  headers,
@@ -178,15 +178,27 @@ export type MessageRelationships =
178
178
  | 'mentionedList'
179
179
  | 'interpolatedHsmMessage'
180
180
 
181
+ /** A file sent inline in a message. `base64` may also be a `data:` URL, which carries the mimetype. */
182
+ export type MessageFileInput = {
183
+ base64: string
184
+ mimetype: string
185
+ name: string
186
+ }
187
+
181
188
  export type CreateMessagePayload = {
182
189
  text?: string
183
190
  contactId?: string
184
191
  number?: string
192
+ /** Name of the contact created when the message is sent by `number`. */
193
+ name?: string
185
194
  serviceId?: string
186
195
  userId?: string
196
+ /** The file sent with the message, usually a {@link MessageFileInput}; `text` goes as its caption. */
187
197
  file?: unknown
188
198
  fileId?: string
189
199
  filesIds?: string[]
200
+ /** Files attached to an e-mail. The other connections send a single `file`. */
201
+ attachments?: MessageFileInput[]
190
202
  quotedMessageId?: string
191
203
  hsmId?: string
192
204
  hsm?: unknown
@@ -199,7 +211,21 @@ export type CreateMessagePayload = {
199
211
  mentionedList?: string[]
200
212
  interactiveMessage?: unknown
201
213
  stickerId?: string
214
+ /**
215
+ * Sends an audio as a voice note. When omitted the audio is converted as a voice note (the
216
+ * backend defaults it to `true` on the conversion).
217
+ */
202
218
  isPtt?: boolean
219
+ /** Sends the file as a document, keeping its original format (audio is not converted). */
220
+ sendAsDocument?: boolean
221
+ /** Template parameters of a WhatsApp Business HSM. */
222
+ parameters?: unknown
223
+ /** Header media of a WhatsApp Business HSM. */
224
+ fileTemplate?: MessageFileInput
225
+ /** Contact card sent by a WhatsApp Business connection. Other connections use `sendVcards`. */
226
+ vcard?: unknown
227
+ /** Actions shown by the webchat widget. */
228
+ actions?: unknown
203
229
  subject?: string
204
230
  ccs?: unknown[]
205
231
  }
@@ -234,6 +260,20 @@ export type SendVcardsPayload = {
234
260
  contactsIds: string[]
235
261
  }
236
262
 
263
+ /**
264
+ * What `POST /messages/{id}/revoke` answers, by channel: `true` on the channels the API drives itself (WhatsApp and the
265
+ * channels whose adapter has no revoke), and an empty object on the channels of workers-go (e.g. Telegram), which answer
266
+ * the result of the revoke job. Read `data.softRevoked` of the message for the effect.
267
+ */
268
+ export type RevokeMessageResult = boolean | Record<string, never>
269
+
270
+ /**
271
+ * What `POST /messages/send-vcards` answers, by channel: the vCard message on WhatsApp, an empty object on the channels
272
+ * of workers-go (e.g. Telegram), which answer the result of the send job, and `null` on a channel without vCard (e.g.
273
+ * Webchat, SMS), where nothing is sent.
274
+ */
275
+ export type SendVcardsResult = Message | Record<string, never> | null
276
+
237
277
  export type SendReactionPayload = {
238
278
  reactionEmojiRendered: string
239
279
  reactionCode?: string
@@ -100,7 +100,7 @@ import { ServicesApi } from './services/ServicesApi'
100
100
  import type { BulkUpdateUsersLinksResult, UpdateUserPayload, User } from './users/types'
101
101
  import { WebhooksApi } from './webhooks/WebhooksApi'
102
102
  import type { KanbanColumn } from './kanbanColumns/types'
103
- import type { Message } from './messages/types'
103
+ import type { CreateMessagePayload, Message } from './messages/types'
104
104
  import type { Webhook, WebhookMessageFilters, WebhookType } from './webhooks/types'
105
105
 
106
106
  declare const client: ApiClient
@@ -691,6 +691,17 @@ expectType<Promise<Department>>(
691
691
  )
692
692
  expectError(new DepartmentsApi(client).archiveWithValidation('d-1', {}))
693
693
  new MessagesApi(client).updateById('m-1', { text: 'x', contactId: 'c-1', mentionedList: ['5511'] })
694
+ expectAssignable<CreateMessagePayload>({
695
+ contactId: 'c-1',
696
+ file: { base64: 'AAAA', mimetype: 'audio/mpeg', name: 'a.mp3' },
697
+ isPtt: false,
698
+ sendAsDocument: true,
699
+ })
700
+ expectAssignable<CreateMessagePayload>({
701
+ contactId: 'c-1',
702
+ attachments: [{ base64: 'AAAA', mimetype: 'application/pdf', name: 'a.pdf' }],
703
+ })
704
+ expectNotAssignable<CreateMessagePayload>({ attachments: [{ base64: 'AAAA' }] })
694
705
  expectAssignable<UpdateUserPayload>({ restrictedServices: [{ value: 's-1' }], password: 'x' })
695
706
  expectNotAssignable<UpdateUserPayload>({ restrictedServices: ['s-1'] })
696
707