bandwidth-sdk 7.2.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/messages-api.ts +4 -4
- package/bandwidth.yml +30 -5
- package/configuration.ts +1 -1
- package/coverage/clover.xml +2 -2
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/node-sdk/api/calls-api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/api/conferences-api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/api/index.html +1 -1
- package/coverage/lcov-report/node-sdk/api/media-api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/api/messages-api.ts.html +5 -5
- package/coverage/lcov-report/node-sdk/api/mfaapi.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/api/multi-channel-api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/api/phone-number-lookup-api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/api/recordings-api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/api/statistics-api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/api/toll-free-verification-api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/api/transcriptions-api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/api.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/base.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/common.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/configuration.ts.html +2 -2
- package/coverage/lcov-report/node-sdk/index.html +1 -1
- package/coverage/lcov-report/node-sdk/models/business-entity-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/business-registration-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/Bxml.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/NestableVerb.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/Response.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/Root.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/Verb.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/index.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/index.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Bridge.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Conference.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/CustomParam.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Forward.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Gather.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Hangup.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Pause.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/PauseRecording.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/PhoneNumber.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/PlayAudio.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Record.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Redirect.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/ResumeRecording.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Ring.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/SendDtmf.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/SipUri.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/SpeakSentence.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartGather.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartRecording.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartStream.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StartTranscription.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopGather.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopRecording.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopStream.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StopTranscription.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/StreamParam.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Tag.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/Transfer.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/index.html +1 -1
- package/coverage/lcov-report/node-sdk/models/bxml/verbs/index.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/call-direction-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/call-state-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/call-transcription-detected-language-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/call-transcription-track-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/callback-method-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/card-width-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/completed-lookup-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/conference-state-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/deactivation-event-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/file-format-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/in-progress-lookup-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/inbound-callback-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/index.html +1 -1
- package/coverage/lcov-report/node-sdk/models/index.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/latest-message-delivery-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/line-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/list-message-direction-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/machine-detection-mode-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/message-direction-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/message-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/message-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/multi-channel-message-channel-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/priority-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/product-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/rbm-action-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/rbm-media-height-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/rbm-open-url-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/rbm-web-view-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/recording-state-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/redirect-method-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/standalone-card-orientation-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/status-callback-type-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/tfv-callback-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/tfv-status-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/thumbnail-alignment-enum.ts.html +1 -1
- package/coverage/lcov-report/node-sdk/models/webhook-subscription-type-enum.ts.html +1 -1
- package/dist/api/messages-api.d.ts +4 -4
- package/dist/api/messages-api.js +4 -4
- package/dist/configuration.js +1 -1
- package/dist/models/rbm-message-media.d.ts +1 -1
- package/docs/MessagesApi.md +3 -2
- package/docs/MultiChannelChannelListRBMObjectAllOfContent.md +1 -1
- package/docs/RbmMessageMedia.md +1 -1
- package/models/rbm-message-media.ts +1 -1
- package/package.json +1 -1
- package/tests/smoke/multi-channel-api.test.ts +240 -4
package/dist/api/messages-api.js
CHANGED
|
@@ -153,7 +153,7 @@ var MessagesApiAxiosParamCreator = function (configuration) {
|
|
|
153
153
|
});
|
|
154
154
|
},
|
|
155
155
|
/**
|
|
156
|
-
* Returns a list of messages based on query parameters.
|
|
156
|
+
* Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header.
|
|
157
157
|
* @summary List Messages
|
|
158
158
|
* @param {string} accountId Your Bandwidth Account ID.
|
|
159
159
|
* @param {string} [messageId] The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter.
|
|
@@ -344,7 +344,7 @@ var MessagesApiFp = function (configuration) {
|
|
|
344
344
|
});
|
|
345
345
|
},
|
|
346
346
|
/**
|
|
347
|
-
* Returns a list of messages based on query parameters.
|
|
347
|
+
* Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header.
|
|
348
348
|
* @summary List Messages
|
|
349
349
|
* @param {string} accountId Your Bandwidth Account ID.
|
|
350
350
|
* @param {string} [messageId] The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter.
|
|
@@ -414,7 +414,7 @@ var MessagesApiFactory = function (configuration, basePath, axios) {
|
|
|
414
414
|
return localVarFp.createMessage(accountId, messageRequest, options).then(function (request) { return request(axios, basePath); });
|
|
415
415
|
},
|
|
416
416
|
/**
|
|
417
|
-
* Returns a list of messages based on query parameters.
|
|
417
|
+
* Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header.
|
|
418
418
|
* @summary List Messages
|
|
419
419
|
* @param {string} accountId Your Bandwidth Account ID.
|
|
420
420
|
* @param {string} [messageId] The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter.
|
|
@@ -474,7 +474,7 @@ var MessagesApi = /** @class */ (function (_super) {
|
|
|
474
474
|
return (0, exports.MessagesApiFp)(this.configuration).createMessage(accountId, messageRequest, options).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
475
475
|
};
|
|
476
476
|
/**
|
|
477
|
-
* Returns a list of messages based on query parameters.
|
|
477
|
+
* Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header.
|
|
478
478
|
* @summary List Messages
|
|
479
479
|
* @param {string} accountId Your Bandwidth Account ID.
|
|
480
480
|
* @param {string} [messageId] The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter.
|
package/dist/configuration.js
CHANGED
|
@@ -103,7 +103,7 @@ var Configuration = /** @class */ (function () {
|
|
|
103
103
|
this.awsv4 = param.awsv4;
|
|
104
104
|
this.basePath = param.basePath;
|
|
105
105
|
this.serverIndex = param.serverIndex;
|
|
106
|
-
this.baseOptions = __assign(__assign({}, param.baseOptions), { headers: __assign(__assign({}, (_b = param.baseOptions) === null || _b === void 0 ? void 0 : _b.headers), { 'User-Agent': "OpenAPI-Generator/7.
|
|
106
|
+
this.baseOptions = __assign(__assign({}, param.baseOptions), { headers: __assign(__assign({}, (_b = param.baseOptions) === null || _b === void 0 ? void 0 : _b.headers), { 'User-Agent': "OpenAPI-Generator/7.3.0/typescript-axios" }) });
|
|
107
107
|
this.formDataCtor = param.formDataCtor;
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import type { MultiChannelAction } from './multi-channel-action';
|
|
13
13
|
import type { RbmMessageContentFile } from './rbm-message-content-file';
|
|
14
14
|
export interface RbmMessageMedia {
|
|
15
|
-
'media': RbmMessageContentFile
|
|
15
|
+
'media': Array<RbmMessageContentFile>;
|
|
16
16
|
/**
|
|
17
17
|
* An array of suggested actions for the recipient.
|
|
18
18
|
*/
|
package/docs/MessagesApi.md
CHANGED
|
@@ -74,7 +74,7 @@ const { status, data } = await apiInstance.createMessage(
|
|
|
74
74
|
# **listMessages**
|
|
75
75
|
> MessagesList listMessages()
|
|
76
76
|
|
|
77
|
-
Returns a list of messages based on query parameters.
|
|
77
|
+
Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header.
|
|
78
78
|
|
|
79
79
|
### Example
|
|
80
80
|
|
|
@@ -204,8 +204,9 @@ const { status, data } = await apiInstance.listMessages(
|
|
|
204
204
|
|**401** | Unauthorized | - |
|
|
205
205
|
|**403** | Forbidden | - |
|
|
206
206
|
|**404** | Not Found | - |
|
|
207
|
+
|**405** | Method Not Allowed | - |
|
|
207
208
|
|**415** | Unsupported Media Type | - |
|
|
208
|
-
|**429** | Too Many Requests | - |
|
|
209
|
+
|**429** | Too Many Requests | * Retry-After - The number of seconds to wait before retrying the request. <br> |
|
|
209
210
|
|**500** | Internal Server Error | - |
|
|
210
211
|
|
|
211
212
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
@@ -8,7 +8,7 @@ Name | Type | Description | Notes
|
|
|
8
8
|
------------ | ------------- | ------------- | -------------
|
|
9
9
|
**text** | **string** | The text associated with the message. Must be 3270 characters or less | [default to undefined]
|
|
10
10
|
**suggestions** | [**Array<MultiChannelAction>**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [optional] [default to undefined]
|
|
11
|
-
**media** | [**RbmMessageContentFile
|
|
11
|
+
**media** | [**Array<RbmMessageContentFile>**](RbmMessageContentFile.md) | | [default to undefined]
|
|
12
12
|
**orientation** | [**StandaloneCardOrientationEnum**](StandaloneCardOrientationEnum.md) | | [default to undefined]
|
|
13
13
|
**thumbnailImageAlignment** | [**ThumbnailAlignmentEnum**](ThumbnailAlignmentEnum.md) | | [default to undefined]
|
|
14
14
|
**cardContent** | [**RbmCardContent**](RbmCardContent.md) | | [default to undefined]
|
package/docs/RbmMessageMedia.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Name | Type | Description | Notes
|
|
7
7
|
------------ | ------------- | ------------- | -------------
|
|
8
|
-
**media** | [**RbmMessageContentFile
|
|
8
|
+
**media** | [**Array<RbmMessageContentFile>**](RbmMessageContentFile.md) | | [default to undefined]
|
|
9
9
|
**suggestions** | [**Array<MultiChannelAction>**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [optional] [default to undefined]
|
|
10
10
|
|
|
11
11
|
## Example
|
|
@@ -21,7 +21,7 @@ import type { MultiChannelAction } from './multi-channel-action';
|
|
|
21
21
|
import type { RbmMessageContentFile } from './rbm-message-content-file';
|
|
22
22
|
|
|
23
23
|
export interface RbmMessageMedia {
|
|
24
|
-
'media': RbmMessageContentFile
|
|
24
|
+
'media': Array<RbmMessageContentFile>;
|
|
25
25
|
/**
|
|
26
26
|
* An array of suggested actions for the recipient.
|
|
27
27
|
*/
|
package/package.json
CHANGED
|
@@ -11,7 +11,20 @@ import {
|
|
|
11
11
|
RbmMessageContentText,
|
|
12
12
|
MultiChannelMessageRequest,
|
|
13
13
|
MessageDirectionEnum,
|
|
14
|
-
RbmActionTypeEnum
|
|
14
|
+
RbmActionTypeEnum,
|
|
15
|
+
CardWidthEnum,
|
|
16
|
+
RbmMediaHeightEnum,
|
|
17
|
+
RbmCardContent,
|
|
18
|
+
RbmMessageCarouselCard,
|
|
19
|
+
RbmMessageMedia,
|
|
20
|
+
RbmActionDial,
|
|
21
|
+
MultiChannelChannelListRBMResponseObject,
|
|
22
|
+
RbmStandaloneCard,
|
|
23
|
+
StandaloneCardOrientationEnum,
|
|
24
|
+
ThumbnailAlignmentEnum,
|
|
25
|
+
MultiChannelChannelListSMSObject,
|
|
26
|
+
MultiChannelChannelListMMSObject,
|
|
27
|
+
MultiChannelChannelListRBMObject
|
|
15
28
|
} from '../../models';
|
|
16
29
|
|
|
17
30
|
describe('MultiChannelApi', () => {
|
|
@@ -103,8 +116,8 @@ describe('MultiChannelApi', () => {
|
|
|
103
116
|
});
|
|
104
117
|
});
|
|
105
118
|
|
|
106
|
-
describe('
|
|
107
|
-
test('should create a multi-channel RBM message', async () => {
|
|
119
|
+
describe('createMultiChannelRBMTextMessage', () => {
|
|
120
|
+
test('should create a multi-channel RBM text message', async () => {
|
|
108
121
|
const content: RbmMessageContentText = {
|
|
109
122
|
text: "Hello World!",
|
|
110
123
|
suggestions: [{
|
|
@@ -145,7 +158,230 @@ describe('MultiChannelApi', () => {
|
|
|
145
158
|
expect(data.data?.priority).toBeOneOf(Object.values(PriorityEnum));
|
|
146
159
|
expect(data.data?.expiration).toBeDateString();
|
|
147
160
|
expect(data.data?.channelList).toBeArray();
|
|
148
|
-
expect(data.data?.channelList![0]
|
|
161
|
+
expect(data.data?.channelList![0]).toBeObject();
|
|
162
|
+
const channelListObject = data.data?.channelList![0] as MultiChannelChannelListRBMResponseObject;
|
|
163
|
+
expect(channelListObject.from).toEqual(BW_NUMBER);
|
|
164
|
+
expect(channelListObject.applicationId).toEqual(BW_MESSAGING_APPLICATION_ID);
|
|
165
|
+
expect(channelListObject.channel).toEqual(MultiChannelMessageChannelEnum.Rbm);
|
|
166
|
+
expect(channelListObject.content).toBeObject();
|
|
167
|
+
expect(channelListObject.owner).toEqual(BW_NUMBER);
|
|
168
|
+
const rbmContent = channelListObject.content as RbmMessageContentText;
|
|
169
|
+
expect(rbmContent.text).toBeString();
|
|
170
|
+
expect(rbmContent.suggestions).toBeArray();
|
|
171
|
+
expect(rbmContent.suggestions[0]).toBeObject();
|
|
172
|
+
const rbmActionDial = rbmContent.suggestions[0] as RbmActionDial;
|
|
173
|
+
expect(rbmActionDial.type).toEqual(RbmActionTypeEnum.DialPhone);
|
|
174
|
+
expect(rbmActionDial.text).toBeString();
|
|
175
|
+
expect(rbmActionDial.postbackData).toBeString();
|
|
176
|
+
expect(rbmActionDial.phoneNumber).toBeString();
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
describe('createMultiChannelRBMMediaMessage', () => {
|
|
181
|
+
test('should create a multi-channel RBM media message', async () => {
|
|
182
|
+
const content: RbmMessageMedia = {
|
|
183
|
+
media:[{
|
|
184
|
+
fileUrl: "https://example.com/image.jpg",
|
|
185
|
+
thumbnailUrl: "https://example.com/thumbnail.jpg",
|
|
186
|
+
}],
|
|
187
|
+
suggestions: [{
|
|
188
|
+
type: RbmActionTypeEnum.DialPhone,
|
|
189
|
+
text: "Call Us",
|
|
190
|
+
postbackData: "tel:+1234567890",
|
|
191
|
+
phoneNumber: BW_NUMBER
|
|
192
|
+
}]
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const channelListObject: MultiChannelChannelListRBMObject = {
|
|
196
|
+
from: BW_NUMBER,
|
|
197
|
+
applicationId: BW_MESSAGING_APPLICATION_ID,
|
|
198
|
+
channel: MultiChannelMessageChannelEnum.Rbm,
|
|
199
|
+
content,
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const multiChannelMessageRequest: MultiChannelMessageRequest = {
|
|
203
|
+
to: USER_NUMBER,
|
|
204
|
+
tag: "tag",
|
|
205
|
+
priority: PriorityEnum.High,
|
|
206
|
+
expiration,
|
|
207
|
+
channelList: [channelListObject],
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const { status, data } = await multiChannelApi.createMultiChannelMessage(
|
|
211
|
+
BW_ACCOUNT_ID,
|
|
212
|
+
multiChannelMessageRequest
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
expect(status).toEqual(202);
|
|
216
|
+
expect(data.links).toBeArray();
|
|
217
|
+
expect(data.data?.id).toBeString();
|
|
218
|
+
expect(data.data?.time).toBeDateString();
|
|
219
|
+
expect(data.data?.direction).toBeOneOf(Object.values(MessageDirectionEnum));
|
|
220
|
+
expect(data.data?.to).toBeArray();
|
|
221
|
+
expect(data.data?.tag).toBeString();
|
|
222
|
+
expect(data.data?.priority).toBeOneOf(Object.values(PriorityEnum));
|
|
223
|
+
expect(data.data?.expiration).toBeDateString();
|
|
224
|
+
expect(data.data?.channelList).toBeArray();
|
|
225
|
+
expect(data.data?.channelList![0]).toBeObject();
|
|
226
|
+
const channelListObject = data.data?.channelList![0] as MultiChannelChannelListRBMResponseObject;
|
|
227
|
+
expect(channelListObject.from).toEqual(BW_NUMBER);
|
|
228
|
+
expect(channelListObject.applicationId).toEqual(BW_MESSAGING_APPLICATION_ID);
|
|
229
|
+
expect(channelListObject.channel).toEqual(MultiChannelMessageChannelEnum.Rbm);
|
|
230
|
+
expect(channelListObject.content).toBeObject();
|
|
231
|
+
expect(channelListObject.owner).toEqual(BW_NUMBER);
|
|
232
|
+
const rbmContent = channelListObject.content as RbmMessageMedia;
|
|
233
|
+
expect(rbmContent.media).toBeArray();
|
|
234
|
+
expect(rbmContent.media[0].fileUrl).toBeString();
|
|
235
|
+
expect(rbmContent.media[0].thumbnailUrl).toBeString();
|
|
236
|
+
expect(rbmContent.suggestions).toBeArray();
|
|
237
|
+
expect(rbmContent.suggestions[0]).toBeObject();
|
|
238
|
+
const rbmActionDial = rbmContent.suggestions[0] as RbmActionDial;
|
|
239
|
+
expect(rbmActionDial.type).toEqual(RbmActionTypeEnum.DialPhone);
|
|
240
|
+
expect(rbmActionDial.text).toBeString();
|
|
241
|
+
expect(rbmActionDial.postbackData).toBeString();
|
|
242
|
+
expect(rbmActionDial.phoneNumber).toBeString();
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
describe('createMultiChannelRBMRichStandaloneMessage', () => {
|
|
247
|
+
test('should create a multi-channel RBM standalone rich card message', async () => {
|
|
248
|
+
const content: RbmStandaloneCard = {
|
|
249
|
+
orientation: StandaloneCardOrientationEnum.Horizontal,
|
|
250
|
+
thumbnailImageAlignment: ThumbnailAlignmentEnum.Left,
|
|
251
|
+
cardContent: {
|
|
252
|
+
title: "Test Title"
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const channelListObject: MultiChannelChannelListRBMObject = {
|
|
257
|
+
from: BW_NUMBER,
|
|
258
|
+
applicationId: BW_MESSAGING_APPLICATION_ID,
|
|
259
|
+
channel: MultiChannelMessageChannelEnum.Rbm,
|
|
260
|
+
content,
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const multiChannelMessageRequest: MultiChannelMessageRequest = {
|
|
264
|
+
to: USER_NUMBER,
|
|
265
|
+
tag: "tag",
|
|
266
|
+
priority: PriorityEnum.High,
|
|
267
|
+
expiration,
|
|
268
|
+
channelList: [channelListObject],
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const { status, data } = await multiChannelApi.createMultiChannelMessage(
|
|
272
|
+
BW_ACCOUNT_ID,
|
|
273
|
+
multiChannelMessageRequest
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
expect(status).toEqual(202);
|
|
277
|
+
expect(data.links).toBeArray();
|
|
278
|
+
expect(data.data?.id).toBeString();
|
|
279
|
+
expect(data.data?.time).toBeDateString();
|
|
280
|
+
expect(data.data?.direction).toBeOneOf(Object.values(MessageDirectionEnum));
|
|
281
|
+
expect(data.data?.to).toBeArray();
|
|
282
|
+
expect(data.data?.tag).toBeString();
|
|
283
|
+
expect(data.data?.priority).toBeOneOf(Object.values(PriorityEnum));
|
|
284
|
+
expect(data.data?.expiration).toBeDateString();
|
|
285
|
+
expect(data.data?.channelList).toBeArray();
|
|
286
|
+
expect(data.data?.channelList![0]).toBeObject();
|
|
287
|
+
const channelListObject = data.data?.channelList![0] as MultiChannelChannelListRBMResponseObject;
|
|
288
|
+
expect(channelListObject.from).toEqual(BW_NUMBER);
|
|
289
|
+
expect(channelListObject.applicationId).toEqual(BW_MESSAGING_APPLICATION_ID);
|
|
290
|
+
expect(channelListObject.channel).toEqual(MultiChannelMessageChannelEnum.Rbm);
|
|
291
|
+
expect(channelListObject.content).toBeObject();
|
|
292
|
+
expect(channelListObject.owner).toEqual(BW_NUMBER);
|
|
293
|
+
const rbmContent = channelListObject.content as RbmStandaloneCard;
|
|
294
|
+
expect(rbmContent.orientation).toEqual(StandaloneCardOrientationEnum.Horizontal);
|
|
295
|
+
expect(rbmContent.thumbnailImageAlignment).toEqual(ThumbnailAlignmentEnum.Left);
|
|
296
|
+
expect(rbmContent.cardContent.title).toBeString();
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
describe('createMultiChannelRBMRichCarouselMessage', () => {
|
|
301
|
+
test('should create a multi-channel RBM carousel rich card message', async () => {
|
|
302
|
+
const carouselCard: RbmCardContent = {
|
|
303
|
+
title: "Card 1 Title",
|
|
304
|
+
description: "Card 1 Description",
|
|
305
|
+
media: {
|
|
306
|
+
fileUrl: "https://example.com/image.jpg",
|
|
307
|
+
thumbnailUrl: "https://example.com/thumbnail.jpg",
|
|
308
|
+
height: RbmMediaHeightEnum.Tall
|
|
309
|
+
},
|
|
310
|
+
suggestions: [{
|
|
311
|
+
type: RbmActionTypeEnum.DialPhone,
|
|
312
|
+
text: "Call Us",
|
|
313
|
+
postbackData: "tel:+1234567890",
|
|
314
|
+
phoneNumber: BW_NUMBER
|
|
315
|
+
}]
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
const content: RbmMessageCarouselCard = {
|
|
319
|
+
cardWidth: CardWidthEnum.Medium,
|
|
320
|
+
cardContents: [
|
|
321
|
+
carouselCard,
|
|
322
|
+
{ title: "Card 2 Title" }
|
|
323
|
+
]
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const channelListObject: MultiChannelChannelListRBMObject = {
|
|
327
|
+
from: BW_NUMBER,
|
|
328
|
+
applicationId: BW_MESSAGING_APPLICATION_ID,
|
|
329
|
+
channel: MultiChannelMessageChannelEnum.Rbm,
|
|
330
|
+
content,
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
const multiChannelMessageRequest: MultiChannelMessageRequest = {
|
|
334
|
+
to: USER_NUMBER,
|
|
335
|
+
tag: "tag",
|
|
336
|
+
priority: PriorityEnum.High,
|
|
337
|
+
expiration,
|
|
338
|
+
channelList: [channelListObject],
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const { status, data } = await multiChannelApi.createMultiChannelMessage(
|
|
342
|
+
BW_ACCOUNT_ID,
|
|
343
|
+
multiChannelMessageRequest
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
expect(status).toEqual(202);
|
|
347
|
+
expect(data.links).toBeArray();
|
|
348
|
+
expect(data.data?.id).toBeString();
|
|
349
|
+
expect(data.data?.time).toBeDateString();
|
|
350
|
+
expect(data.data?.direction).toBeOneOf(Object.values(MessageDirectionEnum));
|
|
351
|
+
expect(data.data?.to).toBeArray();
|
|
352
|
+
expect(data.data?.tag).toBeString();
|
|
353
|
+
expect(data.data?.priority).toBeOneOf(Object.values(PriorityEnum));
|
|
354
|
+
expect(data.data?.expiration).toBeDateString();
|
|
355
|
+
expect(data.data?.channelList).toBeArray();
|
|
356
|
+
expect(data.data?.channelList![0]).toBeObject();
|
|
357
|
+
const channelListObject = data.data?.channelList![0] as MultiChannelChannelListRBMResponseObject;
|
|
358
|
+
expect(channelListObject.from).toEqual(BW_NUMBER);
|
|
359
|
+
expect(channelListObject.applicationId).toEqual(BW_MESSAGING_APPLICATION_ID);
|
|
360
|
+
expect(channelListObject.channel).toEqual(MultiChannelMessageChannelEnum.Rbm);
|
|
361
|
+
expect(channelListObject.content).toBeObject();
|
|
362
|
+
expect(channelListObject.owner).toEqual(BW_NUMBER);
|
|
363
|
+
const rbmContent = channelListObject.content as RbmMessageCarouselCard;
|
|
364
|
+
expect(rbmContent.cardWidth).toEqual(CardWidthEnum.Medium);
|
|
365
|
+
expect(rbmContent.cardContents).toBeArray();
|
|
366
|
+
expect(rbmContent.cardContents).toHaveLength(2);
|
|
367
|
+
expect(rbmContent.cardContents[0]).toBeObject();
|
|
368
|
+
const firstCard = rbmContent.cardContents[0] as RbmCardContent;
|
|
369
|
+
expect(firstCard.title).toBeString();
|
|
370
|
+
expect(firstCard.description).toBeString();
|
|
371
|
+
expect(firstCard.media).toBeObject();
|
|
372
|
+
expect(firstCard.media!.fileUrl).toBeString();
|
|
373
|
+
expect(firstCard.media!.thumbnailUrl).toBeString();
|
|
374
|
+
expect(firstCard.media!.height).toEqual(RbmMediaHeightEnum.Tall);
|
|
375
|
+
expect(firstCard.suggestions).toBeArray();
|
|
376
|
+
expect(firstCard.suggestions[0]).toBeObject();
|
|
377
|
+
const rbmActionDial = firstCard.suggestions[0] as RbmActionDial;
|
|
378
|
+
expect(rbmActionDial.type).toEqual(RbmActionTypeEnum.DialPhone);
|
|
379
|
+
expect(rbmActionDial.text).toBeString();
|
|
380
|
+
expect(rbmActionDial.postbackData).toBeString();
|
|
381
|
+
expect(rbmActionDial.phoneNumber).toBeString();
|
|
382
|
+
expect(rbmContent.cardContents[1]).toBeObject();
|
|
383
|
+
const secondCard = rbmContent.cardContents[1] as RbmCardContent;
|
|
384
|
+
expect(secondCard.title).toBeString();
|
|
149
385
|
});
|
|
150
386
|
});
|
|
151
387
|
});
|