@sentdm/sentdm 0.3.5
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/CHANGELOG.md +103 -0
- package/LICENSE +201 -0
- package/README.md +393 -0
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +200 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +200 -0
- package/client.d.ts.map +1 -0
- package/client.js +486 -0
- package/client.js.map +1 -0
- package/client.mjs +482 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +6 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/index.js +30 -0
- package/index.js.map +1 -0
- package/index.mjs +7 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +35 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +87 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +81 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +11 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +137 -0
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/contacts.d.mts +103 -0
- package/resources/contacts.d.mts.map +1 -0
- package/resources/contacts.d.ts +103 -0
- package/resources/contacts.d.ts.map +1 -0
- package/resources/contacts.js +33 -0
- package/resources/contacts.js.map +1 -0
- package/resources/contacts.mjs +29 -0
- package/resources/contacts.mjs.map +1 -0
- package/resources/index.d.mts +6 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +6 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +15 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +7 -0
- package/resources/index.mjs.map +1 -0
- package/resources/messages.d.mts +222 -0
- package/resources/messages.d.mts.map +1 -0
- package/resources/messages.d.ts +222 -0
- package/resources/messages.d.ts.map +1 -0
- package/resources/messages.js +90 -0
- package/resources/messages.js.map +1 -0
- package/resources/messages.mjs +86 -0
- package/resources/messages.mjs.map +1 -0
- package/resources/number-lookup.d.mts +59 -0
- package/resources/number-lookup.d.mts.map +1 -0
- package/resources/number-lookup.d.ts +59 -0
- package/resources/number-lookup.d.ts.map +1 -0
- package/resources/number-lookup.js +17 -0
- package/resources/number-lookup.js.map +1 -0
- package/resources/number-lookup.mjs +13 -0
- package/resources/number-lookup.mjs.map +1 -0
- package/resources/organizations/index.d.mts +3 -0
- package/resources/organizations/index.d.mts.map +1 -0
- package/resources/organizations/index.d.ts +3 -0
- package/resources/organizations/index.d.ts.map +1 -0
- package/resources/organizations/index.js +9 -0
- package/resources/organizations/index.js.map +1 -0
- package/resources/organizations/index.mjs +4 -0
- package/resources/organizations/index.mjs.map +1 -0
- package/resources/organizations/organizations.d.mts +63 -0
- package/resources/organizations/organizations.d.mts.map +1 -0
- package/resources/organizations/organizations.d.ts +63 -0
- package/resources/organizations/organizations.d.ts.map +1 -0
- package/resources/organizations/organizations.js +46 -0
- package/resources/organizations/organizations.js.map +1 -0
- package/resources/organizations/organizations.mjs +41 -0
- package/resources/organizations/organizations.mjs.map +1 -0
- package/resources/organizations/users.d.mts +126 -0
- package/resources/organizations/users.d.mts.map +1 -0
- package/resources/organizations/users.d.ts +126 -0
- package/resources/organizations/users.d.ts.map +1 -0
- package/resources/organizations/users.js +95 -0
- package/resources/organizations/users.js.map +1 -0
- package/resources/organizations/users.mjs +91 -0
- package/resources/organizations/users.mjs.map +1 -0
- package/resources/organizations.d.mts +2 -0
- package/resources/organizations.d.mts.map +1 -0
- package/resources/organizations.d.ts +2 -0
- package/resources/organizations.d.ts.map +1 -0
- package/resources/organizations.js +6 -0
- package/resources/organizations.js.map +1 -0
- package/resources/organizations.mjs +3 -0
- package/resources/organizations.mjs.map +1 -0
- package/resources/templates.d.mts +333 -0
- package/resources/templates.d.mts.map +1 -0
- package/resources/templates.d.ts +333 -0
- package/resources/templates.d.ts.map +1 -0
- package/resources/templates.js +84 -0
- package/resources/templates.js.map +1 -0
- package/resources/templates.mjs +80 -0
- package/resources/templates.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +832 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/index.ts +22 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +128 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +2 -0
- package/src/resources/contacts.ts +142 -0
- package/src/resources/index.ts +38 -0
- package/src/resources/messages.ts +283 -0
- package/src/resources/number-lookup.ts +80 -0
- package/src/resources/organizations/index.ts +18 -0
- package/src/resources/organizations/organizations.ts +116 -0
- package/src/resources/organizations/users.ts +189 -0
- package/src/resources/organizations.ts +3 -0
- package/src/resources/templates.ts +430 -0
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Templates = exports.Organizations = exports.NumberLookup = exports.Messages = exports.Contacts = void 0;
|
|
5
|
+
var contacts_1 = require("./contacts.js");
|
|
6
|
+
Object.defineProperty(exports, "Contacts", { enumerable: true, get: function () { return contacts_1.Contacts; } });
|
|
7
|
+
var messages_1 = require("./messages.js");
|
|
8
|
+
Object.defineProperty(exports, "Messages", { enumerable: true, get: function () { return messages_1.Messages; } });
|
|
9
|
+
var number_lookup_1 = require("./number-lookup.js");
|
|
10
|
+
Object.defineProperty(exports, "NumberLookup", { enumerable: true, get: function () { return number_lookup_1.NumberLookup; } });
|
|
11
|
+
var organizations_1 = require("./organizations/organizations.js");
|
|
12
|
+
Object.defineProperty(exports, "Organizations", { enumerable: true, get: function () { return organizations_1.Organizations; } });
|
|
13
|
+
var templates_1 = require("./templates.js");
|
|
14
|
+
Object.defineProperty(exports, "Templates", { enumerable: true, get: function () { return templates_1.Templates; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0CAOoB;AANlB,oGAAA,QAAQ,OAAA;AAOV,0CAMoB;AALlB,oGAAA,QAAQ,OAAA;AAMV,oDAIyB;AAHvB,6GAAA,YAAY,OAAA;AAId,kEAKuC;AAJrC,8GAAA,aAAa,OAAA;AAKf,4CASqB;AARnB,sGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
export { Contacts, } from "./contacts.mjs";
|
|
3
|
+
export { Messages, } from "./messages.mjs";
|
|
4
|
+
export { NumberLookup, } from "./number-lookup.mjs";
|
|
5
|
+
export { Organizations, } from "./organizations/organizations.mjs";
|
|
6
|
+
export { Templates, } from "./templates.mjs";
|
|
7
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,QAAQ,GAMT;OACM,EACL,QAAQ,GAKT;OACM,EACL,YAAY,GAGb;OACM,EACL,aAAa,GAId;OACM,EACL,SAAS,GAQV"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.mjs";
|
|
3
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
4
|
+
export declare class Messages extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves comprehensive details about a specific message using the message ID.
|
|
7
|
+
* Returns complete message data including delivery status, channel information,
|
|
8
|
+
* template details, contact information, and pricing. The customer ID is extracted
|
|
9
|
+
* from the authentication token to ensure the message belongs to the authenticated
|
|
10
|
+
* customer.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const message = await client.messages.retrieve(
|
|
15
|
+
* '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
16
|
+
* );
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<MessageRetrieveResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Sends a message to a phone number using the default template. This endpoint is
|
|
22
|
+
* rate limited to 5 messages per customer per day. The customer ID is extracted
|
|
23
|
+
* from the authentication token.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* await client.messages.sendQuickMessage({
|
|
28
|
+
* customMessage: 'Hello, this is a test message!',
|
|
29
|
+
* phoneNumber: '+1234567890',
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
sendQuickMessage(body: MessageSendQuickMessageParams, options?: RequestOptions): APIPromise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Sends a message to a specific contact using a template. The message can be sent
|
|
36
|
+
* via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
|
|
37
|
+
* a webhook URL to receive delivery status updates. The customer ID is extracted
|
|
38
|
+
* from the authentication token.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* await client.messages.sendToContact({
|
|
43
|
+
* contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
|
|
44
|
+
* templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
sendToContact(body: MessageSendToContactParams, options?: RequestOptions): APIPromise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Sends a message to a phone number using a template. The phone number doesn't
|
|
51
|
+
* need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
|
|
52
|
+
* Optionally specify a webhook URL to receive delivery status updates. The
|
|
53
|
+
* customer ID is extracted from the authentication token.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* await client.messages.sendToPhone({
|
|
58
|
+
* phoneNumber: '+1234567890',
|
|
59
|
+
* templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
sendToPhone(body: MessageSendToPhoneParams, options?: RequestOptions): APIPromise<void>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Represents a sent message with comprehensive delivery and template information
|
|
67
|
+
* (v2)
|
|
68
|
+
*/
|
|
69
|
+
export interface MessageRetrieveResponse {
|
|
70
|
+
/**
|
|
71
|
+
* The unique identifier of the message
|
|
72
|
+
*/
|
|
73
|
+
id?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The messaging channel used (e.g., SMS, WhatsApp)
|
|
76
|
+
*/
|
|
77
|
+
channel?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The unique identifier of the contact who received the message
|
|
80
|
+
*/
|
|
81
|
+
contactId?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The final price charged for sending this message
|
|
84
|
+
*/
|
|
85
|
+
correctedPrice?: number | null;
|
|
86
|
+
/**
|
|
87
|
+
* The date and time when the message was created
|
|
88
|
+
*/
|
|
89
|
+
createdAt?: string;
|
|
90
|
+
/**
|
|
91
|
+
* The unique identifier of the customer who sent the message
|
|
92
|
+
*/
|
|
93
|
+
customerId?: string;
|
|
94
|
+
/**
|
|
95
|
+
* A chronological list of status change events for this message. Each event
|
|
96
|
+
* includes a status and timestamp, following industry standards (Twilio, SendGrid,
|
|
97
|
+
* Mailgun). Events are ordered chronologically from oldest to newest.
|
|
98
|
+
*/
|
|
99
|
+
events?: Array<MessageRetrieveResponse.Event> | null;
|
|
100
|
+
/**
|
|
101
|
+
* The message body content with variables substituted
|
|
102
|
+
*/
|
|
103
|
+
messageBody?: MessageRetrieveResponse.MessageBody | null;
|
|
104
|
+
/**
|
|
105
|
+
* The phone number of the recipient (E.164 format)
|
|
106
|
+
*/
|
|
107
|
+
phoneNumber?: string;
|
|
108
|
+
/**
|
|
109
|
+
* The phone number in international format
|
|
110
|
+
*/
|
|
111
|
+
phoneNumberInternational?: string;
|
|
112
|
+
/**
|
|
113
|
+
* The region code of the phone number (e.g., US, GB, DE)
|
|
114
|
+
*/
|
|
115
|
+
regionCode?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The delivery status of the message (e.g., sent, delivered, failed, read)
|
|
118
|
+
*/
|
|
119
|
+
status?: string;
|
|
120
|
+
/**
|
|
121
|
+
* The category of the template (e.g., MARKETING, UTILITY, AUTHENTICATION)
|
|
122
|
+
*/
|
|
123
|
+
templateCategory?: string;
|
|
124
|
+
/**
|
|
125
|
+
* The unique identifier of the template used for this message (null if no template
|
|
126
|
+
* was used)
|
|
127
|
+
*/
|
|
128
|
+
templateId?: string | null;
|
|
129
|
+
/**
|
|
130
|
+
* The display name of the template
|
|
131
|
+
*/
|
|
132
|
+
templateName?: string;
|
|
133
|
+
}
|
|
134
|
+
export declare namespace MessageRetrieveResponse {
|
|
135
|
+
/**
|
|
136
|
+
* Represents a status change event in a message's lifecycle Follows industry
|
|
137
|
+
* standards (Twilio, SendGrid, Mailgun pattern)
|
|
138
|
+
*/
|
|
139
|
+
interface Event {
|
|
140
|
+
/**
|
|
141
|
+
* Optional human-readable description of the event Useful for error messages or
|
|
142
|
+
* additional context
|
|
143
|
+
*/
|
|
144
|
+
description?: string | null;
|
|
145
|
+
/**
|
|
146
|
+
* The status of the message at this point in time Examples: "queued", "sent",
|
|
147
|
+
* "delivered", "read", "failed"
|
|
148
|
+
*/
|
|
149
|
+
status?: string;
|
|
150
|
+
/**
|
|
151
|
+
* When this status change occurred (ISO 8601 format)
|
|
152
|
+
*/
|
|
153
|
+
timestamp?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The message body content with variables substituted
|
|
157
|
+
*/
|
|
158
|
+
interface MessageBody {
|
|
159
|
+
buttons?: Array<MessageBody.Button> | null;
|
|
160
|
+
content?: string;
|
|
161
|
+
footer?: string | null;
|
|
162
|
+
header?: string | null;
|
|
163
|
+
}
|
|
164
|
+
namespace MessageBody {
|
|
165
|
+
interface Button {
|
|
166
|
+
type?: string;
|
|
167
|
+
value?: string;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export interface MessageSendQuickMessageParams {
|
|
172
|
+
/**
|
|
173
|
+
* The custom message content to include in the template
|
|
174
|
+
*/
|
|
175
|
+
customMessage: string;
|
|
176
|
+
/**
|
|
177
|
+
* The phone number to send the message to, in international format (e.g.,
|
|
178
|
+
* +1234567890)
|
|
179
|
+
*/
|
|
180
|
+
phoneNumber: string;
|
|
181
|
+
}
|
|
182
|
+
export interface MessageSendToContactParams {
|
|
183
|
+
/**
|
|
184
|
+
* The unique identifier of the contact to send the message to
|
|
185
|
+
*/
|
|
186
|
+
contactId: string;
|
|
187
|
+
/**
|
|
188
|
+
* The unique identifier of the template to use for the message
|
|
189
|
+
*/
|
|
190
|
+
templateId: string;
|
|
191
|
+
/**
|
|
192
|
+
* Optional key-value pairs of template variables to replace in the template body.
|
|
193
|
+
* For example, if your template contains "Hello {{name}}", you would provide {
|
|
194
|
+
* "name": "John Doe" }
|
|
195
|
+
*/
|
|
196
|
+
templateVariables?: {
|
|
197
|
+
[key: string]: string;
|
|
198
|
+
} | null;
|
|
199
|
+
}
|
|
200
|
+
export interface MessageSendToPhoneParams {
|
|
201
|
+
/**
|
|
202
|
+
* The phone number to send the message to, in international format (e.g.,
|
|
203
|
+
* +1234567890)
|
|
204
|
+
*/
|
|
205
|
+
phoneNumber: string;
|
|
206
|
+
/**
|
|
207
|
+
* The unique identifier of the template to use for the message
|
|
208
|
+
*/
|
|
209
|
+
templateId: string;
|
|
210
|
+
/**
|
|
211
|
+
* Optional key-value pairs of template variables to replace in the template body.
|
|
212
|
+
* For example, if your template contains "Hello {{name}}", you would provide {
|
|
213
|
+
* "name": "John Doe" }
|
|
214
|
+
*/
|
|
215
|
+
templateVariables?: {
|
|
216
|
+
[key: string]: string;
|
|
217
|
+
} | null;
|
|
218
|
+
}
|
|
219
|
+
export declare namespace Messages {
|
|
220
|
+
export { type MessageRetrieveResponse as MessageRetrieveResponse, type MessageSendQuickMessageParams as MessageSendQuickMessageParams, type MessageSendToContactParams as MessageSendToContactParams, type MessageSendToPhoneParams as MessageSendToPhoneParams, };
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=messages.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.mts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
4
|
+
export declare class Messages extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves comprehensive details about a specific message using the message ID.
|
|
7
|
+
* Returns complete message data including delivery status, channel information,
|
|
8
|
+
* template details, contact information, and pricing. The customer ID is extracted
|
|
9
|
+
* from the authentication token to ensure the message belongs to the authenticated
|
|
10
|
+
* customer.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const message = await client.messages.retrieve(
|
|
15
|
+
* '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
16
|
+
* );
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<MessageRetrieveResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Sends a message to a phone number using the default template. This endpoint is
|
|
22
|
+
* rate limited to 5 messages per customer per day. The customer ID is extracted
|
|
23
|
+
* from the authentication token.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* await client.messages.sendQuickMessage({
|
|
28
|
+
* customMessage: 'Hello, this is a test message!',
|
|
29
|
+
* phoneNumber: '+1234567890',
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
sendQuickMessage(body: MessageSendQuickMessageParams, options?: RequestOptions): APIPromise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Sends a message to a specific contact using a template. The message can be sent
|
|
36
|
+
* via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
|
|
37
|
+
* a webhook URL to receive delivery status updates. The customer ID is extracted
|
|
38
|
+
* from the authentication token.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* await client.messages.sendToContact({
|
|
43
|
+
* contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
|
|
44
|
+
* templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
sendToContact(body: MessageSendToContactParams, options?: RequestOptions): APIPromise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Sends a message to a phone number using a template. The phone number doesn't
|
|
51
|
+
* need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
|
|
52
|
+
* Optionally specify a webhook URL to receive delivery status updates. The
|
|
53
|
+
* customer ID is extracted from the authentication token.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* await client.messages.sendToPhone({
|
|
58
|
+
* phoneNumber: '+1234567890',
|
|
59
|
+
* templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
sendToPhone(body: MessageSendToPhoneParams, options?: RequestOptions): APIPromise<void>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Represents a sent message with comprehensive delivery and template information
|
|
67
|
+
* (v2)
|
|
68
|
+
*/
|
|
69
|
+
export interface MessageRetrieveResponse {
|
|
70
|
+
/**
|
|
71
|
+
* The unique identifier of the message
|
|
72
|
+
*/
|
|
73
|
+
id?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The messaging channel used (e.g., SMS, WhatsApp)
|
|
76
|
+
*/
|
|
77
|
+
channel?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The unique identifier of the contact who received the message
|
|
80
|
+
*/
|
|
81
|
+
contactId?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The final price charged for sending this message
|
|
84
|
+
*/
|
|
85
|
+
correctedPrice?: number | null;
|
|
86
|
+
/**
|
|
87
|
+
* The date and time when the message was created
|
|
88
|
+
*/
|
|
89
|
+
createdAt?: string;
|
|
90
|
+
/**
|
|
91
|
+
* The unique identifier of the customer who sent the message
|
|
92
|
+
*/
|
|
93
|
+
customerId?: string;
|
|
94
|
+
/**
|
|
95
|
+
* A chronological list of status change events for this message. Each event
|
|
96
|
+
* includes a status and timestamp, following industry standards (Twilio, SendGrid,
|
|
97
|
+
* Mailgun). Events are ordered chronologically from oldest to newest.
|
|
98
|
+
*/
|
|
99
|
+
events?: Array<MessageRetrieveResponse.Event> | null;
|
|
100
|
+
/**
|
|
101
|
+
* The message body content with variables substituted
|
|
102
|
+
*/
|
|
103
|
+
messageBody?: MessageRetrieveResponse.MessageBody | null;
|
|
104
|
+
/**
|
|
105
|
+
* The phone number of the recipient (E.164 format)
|
|
106
|
+
*/
|
|
107
|
+
phoneNumber?: string;
|
|
108
|
+
/**
|
|
109
|
+
* The phone number in international format
|
|
110
|
+
*/
|
|
111
|
+
phoneNumberInternational?: string;
|
|
112
|
+
/**
|
|
113
|
+
* The region code of the phone number (e.g., US, GB, DE)
|
|
114
|
+
*/
|
|
115
|
+
regionCode?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The delivery status of the message (e.g., sent, delivered, failed, read)
|
|
118
|
+
*/
|
|
119
|
+
status?: string;
|
|
120
|
+
/**
|
|
121
|
+
* The category of the template (e.g., MARKETING, UTILITY, AUTHENTICATION)
|
|
122
|
+
*/
|
|
123
|
+
templateCategory?: string;
|
|
124
|
+
/**
|
|
125
|
+
* The unique identifier of the template used for this message (null if no template
|
|
126
|
+
* was used)
|
|
127
|
+
*/
|
|
128
|
+
templateId?: string | null;
|
|
129
|
+
/**
|
|
130
|
+
* The display name of the template
|
|
131
|
+
*/
|
|
132
|
+
templateName?: string;
|
|
133
|
+
}
|
|
134
|
+
export declare namespace MessageRetrieveResponse {
|
|
135
|
+
/**
|
|
136
|
+
* Represents a status change event in a message's lifecycle Follows industry
|
|
137
|
+
* standards (Twilio, SendGrid, Mailgun pattern)
|
|
138
|
+
*/
|
|
139
|
+
interface Event {
|
|
140
|
+
/**
|
|
141
|
+
* Optional human-readable description of the event Useful for error messages or
|
|
142
|
+
* additional context
|
|
143
|
+
*/
|
|
144
|
+
description?: string | null;
|
|
145
|
+
/**
|
|
146
|
+
* The status of the message at this point in time Examples: "queued", "sent",
|
|
147
|
+
* "delivered", "read", "failed"
|
|
148
|
+
*/
|
|
149
|
+
status?: string;
|
|
150
|
+
/**
|
|
151
|
+
* When this status change occurred (ISO 8601 format)
|
|
152
|
+
*/
|
|
153
|
+
timestamp?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The message body content with variables substituted
|
|
157
|
+
*/
|
|
158
|
+
interface MessageBody {
|
|
159
|
+
buttons?: Array<MessageBody.Button> | null;
|
|
160
|
+
content?: string;
|
|
161
|
+
footer?: string | null;
|
|
162
|
+
header?: string | null;
|
|
163
|
+
}
|
|
164
|
+
namespace MessageBody {
|
|
165
|
+
interface Button {
|
|
166
|
+
type?: string;
|
|
167
|
+
value?: string;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export interface MessageSendQuickMessageParams {
|
|
172
|
+
/**
|
|
173
|
+
* The custom message content to include in the template
|
|
174
|
+
*/
|
|
175
|
+
customMessage: string;
|
|
176
|
+
/**
|
|
177
|
+
* The phone number to send the message to, in international format (e.g.,
|
|
178
|
+
* +1234567890)
|
|
179
|
+
*/
|
|
180
|
+
phoneNumber: string;
|
|
181
|
+
}
|
|
182
|
+
export interface MessageSendToContactParams {
|
|
183
|
+
/**
|
|
184
|
+
* The unique identifier of the contact to send the message to
|
|
185
|
+
*/
|
|
186
|
+
contactId: string;
|
|
187
|
+
/**
|
|
188
|
+
* The unique identifier of the template to use for the message
|
|
189
|
+
*/
|
|
190
|
+
templateId: string;
|
|
191
|
+
/**
|
|
192
|
+
* Optional key-value pairs of template variables to replace in the template body.
|
|
193
|
+
* For example, if your template contains "Hello {{name}}", you would provide {
|
|
194
|
+
* "name": "John Doe" }
|
|
195
|
+
*/
|
|
196
|
+
templateVariables?: {
|
|
197
|
+
[key: string]: string;
|
|
198
|
+
} | null;
|
|
199
|
+
}
|
|
200
|
+
export interface MessageSendToPhoneParams {
|
|
201
|
+
/**
|
|
202
|
+
* The phone number to send the message to, in international format (e.g.,
|
|
203
|
+
* +1234567890)
|
|
204
|
+
*/
|
|
205
|
+
phoneNumber: string;
|
|
206
|
+
/**
|
|
207
|
+
* The unique identifier of the template to use for the message
|
|
208
|
+
*/
|
|
209
|
+
templateId: string;
|
|
210
|
+
/**
|
|
211
|
+
* Optional key-value pairs of template variables to replace in the template body.
|
|
212
|
+
* For example, if your template contains "Hello {{name}}", you would provide {
|
|
213
|
+
* "name": "John Doe" }
|
|
214
|
+
*/
|
|
215
|
+
templateVariables?: {
|
|
216
|
+
[key: string]: string;
|
|
217
|
+
} | null;
|
|
218
|
+
}
|
|
219
|
+
export declare namespace Messages {
|
|
220
|
+
export { type MessageRetrieveResponse as MessageRetrieveResponse, type MessageSendQuickMessageParams as MessageSendQuickMessageParams, type MessageSendToContactParams as MessageSendToContactParams, type MessageSendToPhoneParams as MessageSendToPhoneParams, };
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Messages = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const headers_1 = require("../internal/headers.js");
|
|
7
|
+
const path_1 = require("../internal/utils/path.js");
|
|
8
|
+
class Messages extends resource_1.APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves comprehensive details about a specific message using the message ID.
|
|
11
|
+
* Returns complete message data including delivery status, channel information,
|
|
12
|
+
* template details, contact information, and pricing. The customer ID is extracted
|
|
13
|
+
* from the authentication token to ensure the message belongs to the authenticated
|
|
14
|
+
* customer.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const message = await client.messages.retrieve(
|
|
19
|
+
* '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
retrieve(id, options) {
|
|
24
|
+
return this._client.get((0, path_1.path) `/v2/messages/${id}`, options);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Sends a message to a phone number using the default template. This endpoint is
|
|
28
|
+
* rate limited to 5 messages per customer per day. The customer ID is extracted
|
|
29
|
+
* from the authentication token.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* await client.messages.sendQuickMessage({
|
|
34
|
+
* customMessage: 'Hello, this is a test message!',
|
|
35
|
+
* phoneNumber: '+1234567890',
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
sendQuickMessage(body, options) {
|
|
40
|
+
return this._client.post('/v2/messages/quick-message', {
|
|
41
|
+
body,
|
|
42
|
+
...options,
|
|
43
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sends a message to a specific contact using a template. The message can be sent
|
|
48
|
+
* via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
|
|
49
|
+
* a webhook URL to receive delivery status updates. The customer ID is extracted
|
|
50
|
+
* from the authentication token.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* await client.messages.sendToContact({
|
|
55
|
+
* contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
|
|
56
|
+
* templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
sendToContact(body, options) {
|
|
61
|
+
return this._client.post('/v2/messages/contact', {
|
|
62
|
+
body,
|
|
63
|
+
...options,
|
|
64
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Sends a message to a phone number using a template. The phone number doesn't
|
|
69
|
+
* need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
|
|
70
|
+
* Optionally specify a webhook URL to receive delivery status updates. The
|
|
71
|
+
* customer ID is extracted from the authentication token.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* await client.messages.sendToPhone({
|
|
76
|
+
* phoneNumber: '+1234567890',
|
|
77
|
+
* templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
sendToPhone(body, options) {
|
|
82
|
+
return this._client.post('/v2/messages/phone', {
|
|
83
|
+
body,
|
|
84
|
+
...options,
|
|
85
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.Messages = Messages;
|
|
90
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,IAAmC,EAAE,OAAwB;QAC5E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACrD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,IAAgC,EAAE,OAAwB;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC/C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,IAA8B,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC7C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAnFD,4BAmFC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
|
+
import { path } from "../internal/utils/path.mjs";
|
|
5
|
+
export class Messages extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves comprehensive details about a specific message using the message ID.
|
|
8
|
+
* Returns complete message data including delivery status, channel information,
|
|
9
|
+
* template details, contact information, and pricing. The customer ID is extracted
|
|
10
|
+
* from the authentication token to ensure the message belongs to the authenticated
|
|
11
|
+
* customer.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const message = await client.messages.retrieve(
|
|
16
|
+
* '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
retrieve(id, options) {
|
|
21
|
+
return this._client.get(path `/v2/messages/${id}`, options);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Sends a message to a phone number using the default template. This endpoint is
|
|
25
|
+
* rate limited to 5 messages per customer per day. The customer ID is extracted
|
|
26
|
+
* from the authentication token.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* await client.messages.sendQuickMessage({
|
|
31
|
+
* customMessage: 'Hello, this is a test message!',
|
|
32
|
+
* phoneNumber: '+1234567890',
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
sendQuickMessage(body, options) {
|
|
37
|
+
return this._client.post('/v2/messages/quick-message', {
|
|
38
|
+
body,
|
|
39
|
+
...options,
|
|
40
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Sends a message to a specific contact using a template. The message can be sent
|
|
45
|
+
* via SMS or WhatsApp depending on the contact's capabilities. Optionally specify
|
|
46
|
+
* a webhook URL to receive delivery status updates. The customer ID is extracted
|
|
47
|
+
* from the authentication token.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* await client.messages.sendToContact({
|
|
52
|
+
* contactId: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
|
|
53
|
+
* templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
sendToContact(body, options) {
|
|
58
|
+
return this._client.post('/v2/messages/contact', {
|
|
59
|
+
body,
|
|
60
|
+
...options,
|
|
61
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Sends a message to a phone number using a template. The phone number doesn't
|
|
66
|
+
* need to be a pre-existing contact. The message can be sent via SMS or WhatsApp.
|
|
67
|
+
* Optionally specify a webhook URL to receive delivery status updates. The
|
|
68
|
+
* customer ID is extracted from the authentication token.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* await client.messages.sendToPhone({
|
|
73
|
+
* phoneNumber: '+1234567890',
|
|
74
|
+
* templateId: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
sendToPhone(body, options) {
|
|
79
|
+
return this._client.post('/v2/messages/phone', {
|
|
80
|
+
body,
|
|
81
|
+
...options,
|
|
82
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=messages.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gBAAgB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,IAAmC,EAAE,OAAwB;QAC5E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACrD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,IAAgC,EAAE,OAAwB;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC/C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,IAA8B,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC7C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
|