@unlimited-messaging/sdk 0.1.12 → 0.1.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unlimited-messaging/sdk",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "TypeScript / Node.js SDK for the Unlimited Messaging API — send and receive WhatsApp messages programmatically",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as errors from "../../errors/index";
5
+ import * as core from "../../core";
6
+ export declare class ConflictError extends errors.UnlimitedMessagingApiError {
7
+ constructor(body?: unknown, rawResponse?: core.RawResponse);
8
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.ConflictError = void 0;
40
+ const errors = __importStar(require("../../errors/index"));
41
+ class ConflictError extends errors.UnlimitedMessagingApiError {
42
+ constructor(body, rawResponse) {
43
+ super({
44
+ message: "ConflictError",
45
+ statusCode: 409,
46
+ body: body,
47
+ rawResponse: rawResponse,
48
+ });
49
+ Object.setPrototypeOf(this, ConflictError.prototype);
50
+ }
51
+ }
52
+ exports.ConflictError = ConflictError;
@@ -2,5 +2,6 @@ export * from "./BadRequestError";
2
2
  export * from "./UnauthorizedError";
3
3
  export * from "./ForbiddenError";
4
4
  export * from "./NotFoundError";
5
+ export * from "./ConflictError";
5
6
  export * from "./UnprocessableEntityError";
6
7
  export * from "./ServiceUnavailableError";
@@ -18,5 +18,6 @@ __exportStar(require("./BadRequestError"), exports);
18
18
  __exportStar(require("./UnauthorizedError"), exports);
19
19
  __exportStar(require("./ForbiddenError"), exports);
20
20
  __exportStar(require("./NotFoundError"), exports);
21
+ __exportStar(require("./ConflictError"), exports);
21
22
  __exportStar(require("./UnprocessableEntityError"), exports);
22
23
  __exportStar(require("./ServiceUnavailableError"), exports);
@@ -31,7 +31,7 @@ export declare class Messages {
31
31
  /**
32
32
  * **Protection**: Protected endpoint. Allowed roles: USER, ADMIN. Required scopes: OTHER:READ
33
33
  *
34
- * Returns a paginated list of messages for the authenticated user. Supports filtering by `status`, `messagingAccountId`, and free-text `search`. Results are ordered by creation date (most recent first). Use `page` (default 1) and `limit` (1–100, default 20) to paginate.
34
+ * Returns a paginated list of messages for the authenticated user. Supports filtering by `status`, `messagingAccountId`, and free-text `search`. Results are ordered by creation date (most recent first). Use `page` (default 1) and `limit` (1-100, default 20) to paginate. `simId` is a deprecated alias for `messagingAccountId`, removed 2026-12-16.
35
35
  *
36
36
  * @param {UnlimitedMessagingApi.MessageFindAllRequest} request
37
37
  * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
@@ -48,7 +48,7 @@ export declare class Messages {
48
48
  /**
49
49
  * **Protection**: Protected endpoint. Allowed roles: USER, ADMIN. Required scopes: OTHER:WRITE
50
50
  *
51
- * Queues a WhatsApp message for delivery to the specified `recipient` phone number (E.164 format). If `accountId` is omitted, the platform resolves an account automatically using this priority order: (1) if the caller has exactly one active account, it is used; (2) if the caller has no account, the shared system account is used as fallback; (3) if the caller has multiple active accounts, a `400` is returned asking to specify `accountId`. Returns `404` if no account is available at all. Message text is limited to 1 600 characters.
51
+ * Queues a WhatsApp message for delivery to the specified `recipient`: a phone number (E.164 format) for a 1:1 chat, or a WhatsApp group id (numeric, with or without its `@g.us` suffix) to address a group directly. If `accountId` is omitted, the platform resolves an account automatically using this priority order: (1) if the caller has exactly one active account, it is used; (2) if the caller has no account, the shared system account is used as fallback; (3) if the caller has multiple active accounts, a `400` is returned asking to specify `accountId`. Returns `404` if no account is available at all. Message text is limited to 1 600 characters. Provide `replyToMessageId` instead of `recipient` to send a quoted reply to a message already in the account's history: the conversation (a group included) and the account used are both derived from that message, and `accountId` is ignored. Beta (whatsmeow) WhatsApp accounts only for now. `simId` is a deprecated alias for `accountId`, removed 2026-12-16.
52
52
  *
53
53
  * @param {UnlimitedMessagingApi.MessageSendRequest} request
54
54
  * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
@@ -57,11 +57,11 @@ export declare class Messages {
57
57
  * @throws {@link UnlimitedMessagingApi.UnauthorizedError}
58
58
  * @throws {@link UnlimitedMessagingApi.ForbiddenError}
59
59
  * @throws {@link UnlimitedMessagingApi.NotFoundError}
60
+ * @throws {@link UnlimitedMessagingApi.ConflictError}
60
61
  * @throws {@link UnlimitedMessagingApi.UnprocessableEntityError}
61
62
  *
62
63
  * @example
63
64
  * await client.messages.messageSend({
64
- * recipient: "recipient",
65
65
  * text: "text"
66
66
  * })
67
67
  */
@@ -65,7 +65,7 @@ class Messages {
65
65
  /**
66
66
  * **Protection**: Protected endpoint. Allowed roles: USER, ADMIN. Required scopes: OTHER:READ
67
67
  *
68
- * Returns a paginated list of messages for the authenticated user. Supports filtering by `status`, `messagingAccountId`, and free-text `search`. Results are ordered by creation date (most recent first). Use `page` (default 1) and `limit` (1–100, default 20) to paginate.
68
+ * Returns a paginated list of messages for the authenticated user. Supports filtering by `status`, `messagingAccountId`, and free-text `search`. Results are ordered by creation date (most recent first). Use `page` (default 1) and `limit` (1-100, default 20) to paginate. `simId` is a deprecated alias for `messagingAccountId`, removed 2026-12-16.
69
69
  *
70
70
  * @param {UnlimitedMessagingApi.MessageFindAllRequest} request
71
71
  * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
@@ -83,7 +83,7 @@ class Messages {
83
83
  __messageFindAll() {
84
84
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
85
85
  var _a, _b;
86
- const { page, limit, channel, status, direction, messagingAccountId, search } = request;
86
+ const { page, limit, channel, status, direction, messagingAccountId, simId, search } = request;
87
87
  const _queryParams = {};
88
88
  if (page != null) {
89
89
  _queryParams["page"] = page.toString();
@@ -109,6 +109,9 @@ class Messages {
109
109
  if (messagingAccountId != null) {
110
110
  _queryParams["messagingAccountId"] = messagingAccountId;
111
111
  }
112
+ if (simId != null) {
113
+ _queryParams["simId"] = simId;
114
+ }
112
115
  if (search != null) {
113
116
  _queryParams["search"] = search;
114
117
  }
@@ -171,7 +174,7 @@ class Messages {
171
174
  /**
172
175
  * **Protection**: Protected endpoint. Allowed roles: USER, ADMIN. Required scopes: OTHER:WRITE
173
176
  *
174
- * Queues a WhatsApp message for delivery to the specified `recipient` phone number (E.164 format). If `accountId` is omitted, the platform resolves an account automatically using this priority order: (1) if the caller has exactly one active account, it is used; (2) if the caller has no account, the shared system account is used as fallback; (3) if the caller has multiple active accounts, a `400` is returned asking to specify `accountId`. Returns `404` if no account is available at all. Message text is limited to 1 600 characters.
177
+ * Queues a WhatsApp message for delivery to the specified `recipient`: a phone number (E.164 format) for a 1:1 chat, or a WhatsApp group id (numeric, with or without its `@g.us` suffix) to address a group directly. If `accountId` is omitted, the platform resolves an account automatically using this priority order: (1) if the caller has exactly one active account, it is used; (2) if the caller has no account, the shared system account is used as fallback; (3) if the caller has multiple active accounts, a `400` is returned asking to specify `accountId`. Returns `404` if no account is available at all. Message text is limited to 1 600 characters. Provide `replyToMessageId` instead of `recipient` to send a quoted reply to a message already in the account's history: the conversation (a group included) and the account used are both derived from that message, and `accountId` is ignored. Beta (whatsmeow) WhatsApp accounts only for now. `simId` is a deprecated alias for `accountId`, removed 2026-12-16.
175
178
  *
176
179
  * @param {UnlimitedMessagingApi.MessageSendRequest} request
177
180
  * @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
@@ -180,11 +183,11 @@ class Messages {
180
183
  * @throws {@link UnlimitedMessagingApi.UnauthorizedError}
181
184
  * @throws {@link UnlimitedMessagingApi.ForbiddenError}
182
185
  * @throws {@link UnlimitedMessagingApi.NotFoundError}
186
+ * @throws {@link UnlimitedMessagingApi.ConflictError}
183
187
  * @throws {@link UnlimitedMessagingApi.UnprocessableEntityError}
184
188
  *
185
189
  * @example
186
190
  * await client.messages.messageSend({
187
- * recipient: "recipient",
188
191
  * text: "text"
189
192
  * })
190
193
  */
@@ -227,6 +230,8 @@ class Messages {
227
230
  throw new UnlimitedMessagingApi.ForbiddenError(_response.error.body, _response.rawResponse);
228
231
  case 404:
229
232
  throw new UnlimitedMessagingApi.NotFoundError(_response.error.body, _response.rawResponse);
233
+ case 409:
234
+ throw new UnlimitedMessagingApi.ConflictError(_response.error.body, _response.rawResponse);
230
235
  case 422:
231
236
  throw new UnlimitedMessagingApi.UnprocessableEntityError(_response.error.body, _response.rawResponse);
232
237
  default:
@@ -13,5 +13,6 @@ export interface MessageFindAllRequest {
13
13
  status?: UnlimitedMessagingApi.MessageFindAllRequestStatus;
14
14
  direction?: UnlimitedMessagingApi.MessageFindAllRequestDirection;
15
15
  messagingAccountId?: string;
16
+ simId?: string;
16
17
  search?: string;
17
18
  }
@@ -4,12 +4,13 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * recipient: "recipient",
8
7
  * text: "text"
9
8
  * }
10
9
  */
11
10
  export interface MessageSendRequest {
12
- recipient: string;
11
+ recipient?: string;
13
12
  text: string;
14
13
  accountId?: string | null;
14
+ simId?: string | null;
15
+ replyToMessageId?: string;
15
16
  }
@@ -9,6 +9,8 @@ export interface MessageFindAllResponseDataItem {
9
9
  externalId: string | null;
10
10
  error: string | null;
11
11
  interlocutor: string;
12
+ conversationId: string | null;
13
+ isGroup: boolean;
12
14
  retryCount: number;
13
15
  messagingAccountId: string;
14
16
  status: UnlimitedMessagingApi.MessageFindAllResponseDataItemStatus;
@@ -9,6 +9,8 @@ export interface MessageFindOneResponse {
9
9
  externalId: string | null;
10
10
  error: string | null;
11
11
  interlocutor: string;
12
+ conversationId: string | null;
13
+ isGroup: boolean;
12
14
  retryCount: number;
13
15
  messagingAccountId: string;
14
16
  status: UnlimitedMessagingApi.MessageFindOneResponseStatus;
@@ -9,6 +9,8 @@ export interface MessageSendResponse {
9
9
  externalId: string | null;
10
10
  error: string | null;
11
11
  interlocutor: string;
12
+ conversationId: string | null;
13
+ isGroup: boolean;
12
14
  retryCount: number;
13
15
  messagingAccountId: string;
14
16
  status: UnlimitedMessagingApi.MessageSendResponseStatus;
@@ -7,8 +7,10 @@ import * as core from "../../../../../core";
7
7
  export declare const MessageSendRequest: core.serialization.Schema<serializers.MessageSendRequest.Raw, UnlimitedMessagingApi.MessageSendRequest>;
8
8
  export declare namespace MessageSendRequest {
9
9
  interface Raw {
10
- recipient: string;
10
+ recipient?: string | null;
11
11
  text: string;
12
12
  accountId?: (string | null) | null;
13
+ simId?: (string | null) | null;
14
+ replyToMessageId?: string | null;
13
15
  }
14
16
  }
@@ -39,7 +39,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.MessageSendRequest = void 0;
40
40
  const core = __importStar(require("../../../../../core"));
41
41
  exports.MessageSendRequest = core.serialization.object({
42
- recipient: core.serialization.string(),
42
+ recipient: core.serialization.string().optional(),
43
43
  text: core.serialization.string(),
44
44
  accountId: core.serialization.string().optionalNullable(),
45
+ simId: core.serialization.string().optionalNullable(),
46
+ replyToMessageId: core.serialization.string().optional(),
45
47
  });
@@ -17,6 +17,8 @@ export declare namespace MessageFindAllResponseDataItem {
17
17
  externalId: string | null;
18
18
  error: string | null;
19
19
  interlocutor: string;
20
+ conversationId: string | null;
21
+ isGroup: boolean;
20
22
  retryCount: number;
21
23
  messagingAccountId: string;
22
24
  status: MessageFindAllResponseDataItemStatus.Raw;
@@ -49,6 +49,8 @@ exports.MessageFindAllResponseDataItem = core.serialization.object({
49
49
  externalId: core.serialization.string().nullable(),
50
50
  error: core.serialization.string().nullable(),
51
51
  interlocutor: core.serialization.string(),
52
+ conversationId: core.serialization.string().nullable(),
53
+ isGroup: core.serialization.boolean(),
52
54
  retryCount: core.serialization.number(),
53
55
  messagingAccountId: core.serialization.string(),
54
56
  status: MessageFindAllResponseDataItemStatus_1.MessageFindAllResponseDataItemStatus,
@@ -17,6 +17,8 @@ export declare namespace MessageFindOneResponse {
17
17
  externalId: string | null;
18
18
  error: string | null;
19
19
  interlocutor: string;
20
+ conversationId: string | null;
21
+ isGroup: boolean;
20
22
  retryCount: number;
21
23
  messagingAccountId: string;
22
24
  status: MessageFindOneResponseStatus.Raw;
@@ -49,6 +49,8 @@ exports.MessageFindOneResponse = core.serialization.object({
49
49
  externalId: core.serialization.string().nullable(),
50
50
  error: core.serialization.string().nullable(),
51
51
  interlocutor: core.serialization.string(),
52
+ conversationId: core.serialization.string().nullable(),
53
+ isGroup: core.serialization.boolean(),
52
54
  retryCount: core.serialization.number(),
53
55
  messagingAccountId: core.serialization.string(),
54
56
  status: MessageFindOneResponseStatus_1.MessageFindOneResponseStatus,
@@ -17,6 +17,8 @@ export declare namespace MessageSendResponse {
17
17
  externalId: string | null;
18
18
  error: string | null;
19
19
  interlocutor: string;
20
+ conversationId: string | null;
21
+ isGroup: boolean;
20
22
  retryCount: number;
21
23
  messagingAccountId: string;
22
24
  status: MessageSendResponseStatus.Raw;
@@ -49,6 +49,8 @@ exports.MessageSendResponse = core.serialization.object({
49
49
  externalId: core.serialization.string().nullable(),
50
50
  error: core.serialization.string().nullable(),
51
51
  interlocutor: core.serialization.string(),
52
+ conversationId: core.serialization.string().nullable(),
53
+ isGroup: core.serialization.boolean(),
52
54
  retryCount: core.serialization.number(),
53
55
  messagingAccountId: core.serialization.string(),
54
56
  status: MessageSendResponseStatus_1.MessageSendResponseStatus,