activitysmith 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -5
- package/dist/generated/apis/PushNotificationsApi.d.ts +17 -3
- package/dist/generated/apis/PushNotificationsApi.js +40 -2
- package/dist/generated/models/index.d.ts +335 -0
- package/dist/src/ActivitySmith.d.ts +8 -0
- package/dist/src/ActivitySmith.js +14 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ await activitysmith.notifications.send({
|
|
|
42
42
|
|
|
43
43
|

|
|
44
44
|
|
|
45
|
-
Set `icon` to a publicly accessible HTTPS image URL to show
|
|
45
|
+
Set `icon` to a publicly accessible HTTPS image URL to show a logo or avatar alongside a smaller ActivitySmith app icon. With a custom icon, iOS may omit `subtitle` from the notification.
|
|
46
46
|
|
|
47
47
|
```js
|
|
48
48
|
await activitysmith.notifications.send({
|
|
@@ -190,6 +190,24 @@ await activitysmith.notifications.send({
|
|
|
190
190
|
});
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
+
### Replace a Push Notification
|
|
194
|
+
|
|
195
|
+
Every send returns a `notification_id`. Pass it to `replace` to update a Push Notification you already sent, for example when an incident you alerted on is resolved. The replacement takes the old notification's place on the Lock Screen and in history instead of stacking a second one. It arrives silently, without sound or waking the screen, and goes to the same recipients as the original.
|
|
196
|
+
|
|
197
|
+
Omit `metadata` or `tags` to keep their stored values.
|
|
198
|
+
|
|
199
|
+
```js
|
|
200
|
+
const sent = await activitysmith.notifications.send({
|
|
201
|
+
title: "🚨 checkout-api is down",
|
|
202
|
+
message: "500 errors on 62% of requests.",
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
await activitysmith.notifications.replace(sent.notification_id, {
|
|
206
|
+
title: "✅ checkout-api recovered",
|
|
207
|
+
message: "Error rate is back to normal. Incident resolved.",
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
193
211
|
## Live Activities
|
|
194
212
|
|
|
195
213
|
Choose the Live Activity type that matches what you want to show:
|
|
@@ -226,6 +244,9 @@ Choose the Live Activity type that matches what you want to show:
|
|
|
226
244
|
|
|
227
245
|
Use a stable `streamKey` to identify the metric, job, deployment, or system you want to keep visible. The first `stream(...)` call starts the Live Activity. Later calls with the same `streamKey` update it.
|
|
228
246
|
|
|
247
|
+
> [!WARNING]
|
|
248
|
+
> iOS limits how often a Live Activity can update. Short bursts that end, like deployment steps, are fine. If one Live Activity keeps updating more often than every couple of minutes, iOS throttles it until the budget refills, roughly an hour, even though the API still returns `200`. [Learn more](https://activitysmith.com/docs/live-activity-stream#update-frequency-and-ios-limits)
|
|
249
|
+
|
|
229
250
|
#### Value
|
|
230
251
|
|
|
231
252
|

|
|
@@ -689,7 +710,3 @@ try {
|
|
|
689
710
|
### [NPM Package](https://www.npmjs.com/package/activitysmith)
|
|
690
711
|
|
|
691
712
|
Install the ActivitySmith Node.js SDK from npm
|
|
692
|
-
|
|
693
|
-
### [Source Code](https://github.com/ActivitySmithHQ/activitysmith-node)
|
|
694
|
-
|
|
695
|
-
View the Node.js SDK source on GitHub
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime';
|
|
13
|
-
import type { PushNotificationRequest, PushNotificationResponse } from '../models/index';
|
|
13
|
+
import type { PushNotificationReplaceRequest, PushNotificationReplaceResponse, PushNotificationRequest, PushNotificationResponse } from '../models/index';
|
|
14
|
+
export interface ReplacePushNotificationRequest {
|
|
15
|
+
notificationId: string;
|
|
16
|
+
pushNotificationReplaceRequest: PushNotificationReplaceRequest;
|
|
17
|
+
}
|
|
14
18
|
export interface SendPushNotificationRequest {
|
|
15
19
|
pushNotificationRequest: PushNotificationRequest;
|
|
16
20
|
}
|
|
@@ -19,12 +23,22 @@ export interface SendPushNotificationRequest {
|
|
|
19
23
|
*/
|
|
20
24
|
export declare class PushNotificationsApi extends runtime.BaseAPI {
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
26
|
+
* Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
|
|
27
|
+
* Replace a push notification
|
|
28
|
+
*/
|
|
29
|
+
replacePushNotificationRaw(requestParameters: ReplacePushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationReplaceResponse>>;
|
|
30
|
+
/**
|
|
31
|
+
* Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
|
|
32
|
+
* Replace a push notification
|
|
33
|
+
*/
|
|
34
|
+
replacePushNotification(requestParameters: ReplacePushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationReplaceResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
|
|
23
37
|
* Send a push notification
|
|
24
38
|
*/
|
|
25
39
|
sendPushNotificationRaw(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationResponse>>;
|
|
26
40
|
/**
|
|
27
|
-
* Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a
|
|
41
|
+
* Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
|
|
28
42
|
* Send a push notification
|
|
29
43
|
*/
|
|
30
44
|
sendPushNotification(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationResponse>;
|
|
@@ -20,7 +20,45 @@ const runtime = require("../runtime");
|
|
|
20
20
|
*/
|
|
21
21
|
class PushNotificationsApi extends runtime.BaseAPI {
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
|
|
24
|
+
* Replace a push notification
|
|
25
|
+
*/
|
|
26
|
+
async replacePushNotificationRaw(requestParameters, initOverrides) {
|
|
27
|
+
if (requestParameters['notificationId'] == null) {
|
|
28
|
+
throw new runtime.RequiredError('notificationId', 'Required parameter "notificationId" was null or undefined when calling replacePushNotification().');
|
|
29
|
+
}
|
|
30
|
+
if (requestParameters['pushNotificationReplaceRequest'] == null) {
|
|
31
|
+
throw new runtime.RequiredError('pushNotificationReplaceRequest', 'Required parameter "pushNotificationReplaceRequest" was null or undefined when calling replacePushNotification().');
|
|
32
|
+
}
|
|
33
|
+
const queryParameters = {};
|
|
34
|
+
const headerParameters = {};
|
|
35
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
36
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
37
|
+
const token = this.configuration.accessToken;
|
|
38
|
+
const tokenString = await token("apiKeyAuth", []);
|
|
39
|
+
if (tokenString) {
|
|
40
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const response = await this.request({
|
|
44
|
+
path: `/push-notification/{notification_id}`.replace(`{${"notification_id"}}`, encodeURIComponent(String(requestParameters['notificationId']))),
|
|
45
|
+
method: 'PUT',
|
|
46
|
+
headers: headerParameters,
|
|
47
|
+
query: queryParameters,
|
|
48
|
+
body: requestParameters['pushNotificationReplaceRequest'],
|
|
49
|
+
}, initOverrides);
|
|
50
|
+
return new runtime.JSONApiResponse(response);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Replaces a Push Notification you already sent, using the `notification_id` from the send response. The replacement takes the original\'s place on the Lock Screen and in Notification Center instead of appearing as a second notification. It is delivered silently, with no sound or screen wake, to the same recipients as the original. Notification history is updated in place.
|
|
54
|
+
* Replace a push notification
|
|
55
|
+
*/
|
|
56
|
+
async replacePushNotification(requestParameters, initOverrides) {
|
|
57
|
+
const response = await this.replacePushNotificationRaw(requestParameters, initOverrides);
|
|
58
|
+
return await response.value();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
|
|
24
62
|
* Send a push notification
|
|
25
63
|
*/
|
|
26
64
|
async sendPushNotificationRaw(requestParameters, initOverrides) {
|
|
@@ -47,7 +85,7 @@ class PushNotificationsApi extends runtime.BaseAPI {
|
|
|
47
85
|
return new runtime.JSONApiResponse(response);
|
|
48
86
|
}
|
|
49
87
|
/**
|
|
50
|
-
* Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a
|
|
88
|
+
* Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
|
|
51
89
|
* Send a push notification
|
|
52
90
|
*/
|
|
53
91
|
async sendPushNotification(requestParameters, initOverrides) {
|
|
@@ -215,6 +215,24 @@ export interface AppIconBadgeCountUpdateResponse {
|
|
|
215
215
|
* @memberof AppIconBadgeCountUpdateResponse
|
|
216
216
|
*/
|
|
217
217
|
timestamp: string;
|
|
218
|
+
/**
|
|
219
|
+
* Number of device tokens targeted.
|
|
220
|
+
* @type {number}
|
|
221
|
+
* @memberof AppIconBadgeCountUpdateResponse
|
|
222
|
+
*/
|
|
223
|
+
devices_targeted?: number;
|
|
224
|
+
/**
|
|
225
|
+
* Number of device tokens deactivated because APNs reported them unregistered.
|
|
226
|
+
* @type {number}
|
|
227
|
+
* @memberof AppIconBadgeCountUpdateResponse
|
|
228
|
+
*/
|
|
229
|
+
devices_deactivated?: number;
|
|
230
|
+
/**
|
|
231
|
+
* Number of targeted device tokens APNs reported as unregistered.
|
|
232
|
+
* @type {number}
|
|
233
|
+
* @memberof AppIconBadgeCountUpdateResponse
|
|
234
|
+
*/
|
|
235
|
+
devices_unregistered?: number;
|
|
218
236
|
}
|
|
219
237
|
/**
|
|
220
238
|
*
|
|
@@ -1043,6 +1061,42 @@ export interface LiveActivityEndResponse {
|
|
|
1043
1061
|
* @memberof LiveActivityEndResponse
|
|
1044
1062
|
*/
|
|
1045
1063
|
timestamp: string;
|
|
1064
|
+
/**
|
|
1065
|
+
* True when the Live Activity had already ended and the request had no effect.
|
|
1066
|
+
* @type {boolean}
|
|
1067
|
+
* @memberof LiveActivityEndResponse
|
|
1068
|
+
*/
|
|
1069
|
+
ignored?: boolean;
|
|
1070
|
+
/**
|
|
1071
|
+
*
|
|
1072
|
+
* @type {string}
|
|
1073
|
+
* @memberof LiveActivityEndResponse
|
|
1074
|
+
*/
|
|
1075
|
+
message?: string;
|
|
1076
|
+
/**
|
|
1077
|
+
*
|
|
1078
|
+
* @type {string}
|
|
1079
|
+
* @memberof LiveActivityEndResponse
|
|
1080
|
+
*/
|
|
1081
|
+
end_reason?: string | null;
|
|
1082
|
+
/**
|
|
1083
|
+
* True when the Live Activity was marked complete without a confirmed APNs end delivery.
|
|
1084
|
+
* @type {boolean}
|
|
1085
|
+
* @memberof LiveActivityEndResponse
|
|
1086
|
+
*/
|
|
1087
|
+
forced_completion?: boolean;
|
|
1088
|
+
/**
|
|
1089
|
+
*
|
|
1090
|
+
* @type {string}
|
|
1091
|
+
* @memberof LiveActivityEndResponse
|
|
1092
|
+
*/
|
|
1093
|
+
warning?: string;
|
|
1094
|
+
/**
|
|
1095
|
+
* Per-device delivery errors when some devices could not be reached.
|
|
1096
|
+
* @type {Array<string>}
|
|
1097
|
+
* @memberof LiveActivityEndResponse
|
|
1098
|
+
*/
|
|
1099
|
+
errors?: Array<string>;
|
|
1046
1100
|
}
|
|
1047
1101
|
/**
|
|
1048
1102
|
*
|
|
@@ -1186,6 +1240,24 @@ export interface LiveActivityStartResponse {
|
|
|
1186
1240
|
* @memberof LiveActivityStartResponse
|
|
1187
1241
|
*/
|
|
1188
1242
|
timestamp: string;
|
|
1243
|
+
/**
|
|
1244
|
+
* Present when starting this Live Activity ended an older one to stay within the device limit.
|
|
1245
|
+
* @type {string}
|
|
1246
|
+
* @memberof LiveActivityStartResponse
|
|
1247
|
+
*/
|
|
1248
|
+
ended_activity_id?: string;
|
|
1249
|
+
/**
|
|
1250
|
+
*
|
|
1251
|
+
* @type {string}
|
|
1252
|
+
* @memberof LiveActivityStartResponse
|
|
1253
|
+
*/
|
|
1254
|
+
message?: string;
|
|
1255
|
+
/**
|
|
1256
|
+
* Per-device delivery errors when some devices could not be reached.
|
|
1257
|
+
* @type {Array<string>}
|
|
1258
|
+
* @memberof LiveActivityStartResponse
|
|
1259
|
+
*/
|
|
1260
|
+
errors?: Array<string>;
|
|
1189
1261
|
}
|
|
1190
1262
|
/**
|
|
1191
1263
|
* Optional payload for ending a managed stream. When omitted, ActivitySmith ends the stream using the latest known state when possible.
|
|
@@ -1280,6 +1352,36 @@ export interface LiveActivityStreamDeleteResponse {
|
|
|
1280
1352
|
* @memberof LiveActivityStreamDeleteResponse
|
|
1281
1353
|
*/
|
|
1282
1354
|
timestamp: string;
|
|
1355
|
+
/**
|
|
1356
|
+
* True when the stream was already ended and the request had no effect.
|
|
1357
|
+
* @type {boolean}
|
|
1358
|
+
* @memberof LiveActivityStreamDeleteResponse
|
|
1359
|
+
*/
|
|
1360
|
+
ignored?: boolean;
|
|
1361
|
+
/**
|
|
1362
|
+
*
|
|
1363
|
+
* @type {string}
|
|
1364
|
+
* @memberof LiveActivityStreamDeleteResponse
|
|
1365
|
+
*/
|
|
1366
|
+
message?: string;
|
|
1367
|
+
/**
|
|
1368
|
+
*
|
|
1369
|
+
* @type {boolean}
|
|
1370
|
+
* @memberof LiveActivityStreamDeleteResponse
|
|
1371
|
+
*/
|
|
1372
|
+
forced_completion?: boolean;
|
|
1373
|
+
/**
|
|
1374
|
+
*
|
|
1375
|
+
* @type {string}
|
|
1376
|
+
* @memberof LiveActivityStreamDeleteResponse
|
|
1377
|
+
*/
|
|
1378
|
+
warning?: string;
|
|
1379
|
+
/**
|
|
1380
|
+
* Per-device delivery errors when some devices could not be reached.
|
|
1381
|
+
* @type {Array<string>}
|
|
1382
|
+
* @memberof LiveActivityStreamDeleteResponse
|
|
1383
|
+
*/
|
|
1384
|
+
errors?: Array<string>;
|
|
1283
1385
|
}
|
|
1284
1386
|
/**
|
|
1285
1387
|
* @export
|
|
@@ -1354,12 +1456,42 @@ export interface LiveActivityStreamPutResponse {
|
|
|
1354
1456
|
* @memberof LiveActivityStreamPutResponse
|
|
1355
1457
|
*/
|
|
1356
1458
|
tags?: Array<string>;
|
|
1459
|
+
/**
|
|
1460
|
+
* Present on `updated` responses when the current Live Activity has received more than 12 updates and has averaged more than one update every 2 minutes since it started. The update is still sent, but iOS may throttle Live Activities that update this often.
|
|
1461
|
+
* @type {string}
|
|
1462
|
+
* @memberof LiveActivityStreamPutResponse
|
|
1463
|
+
*/
|
|
1464
|
+
warning?: string;
|
|
1357
1465
|
/**
|
|
1358
1466
|
*
|
|
1359
1467
|
* @type {string}
|
|
1360
1468
|
* @memberof LiveActivityStreamPutResponse
|
|
1361
1469
|
*/
|
|
1362
1470
|
timestamp: string;
|
|
1471
|
+
/**
|
|
1472
|
+
* True when the request had no effect.
|
|
1473
|
+
* @type {boolean}
|
|
1474
|
+
* @memberof LiveActivityStreamPutResponse
|
|
1475
|
+
*/
|
|
1476
|
+
ignored?: boolean;
|
|
1477
|
+
/**
|
|
1478
|
+
*
|
|
1479
|
+
* @type {boolean}
|
|
1480
|
+
* @memberof LiveActivityStreamPutResponse
|
|
1481
|
+
*/
|
|
1482
|
+
remote_push_sent?: boolean;
|
|
1483
|
+
/**
|
|
1484
|
+
*
|
|
1485
|
+
* @type {string}
|
|
1486
|
+
* @memberof LiveActivityStreamPutResponse
|
|
1487
|
+
*/
|
|
1488
|
+
message?: string;
|
|
1489
|
+
/**
|
|
1490
|
+
* Per-device delivery errors when some devices could not be reached.
|
|
1491
|
+
* @type {Array<string>}
|
|
1492
|
+
* @memberof LiveActivityStreamPutResponse
|
|
1493
|
+
*/
|
|
1494
|
+
errors?: Array<string>;
|
|
1363
1495
|
}
|
|
1364
1496
|
/**
|
|
1365
1497
|
* @export
|
|
@@ -1510,6 +1642,48 @@ export interface LiveActivityUpdateResponse {
|
|
|
1510
1642
|
* @memberof LiveActivityUpdateResponse
|
|
1511
1643
|
*/
|
|
1512
1644
|
timestamp: string;
|
|
1645
|
+
/**
|
|
1646
|
+
*
|
|
1647
|
+
* @type {number}
|
|
1648
|
+
* @memberof LiveActivityUpdateResponse
|
|
1649
|
+
*/
|
|
1650
|
+
users_notified?: number;
|
|
1651
|
+
/**
|
|
1652
|
+
*
|
|
1653
|
+
* @type {Array<string>}
|
|
1654
|
+
* @memberof LiveActivityUpdateResponse
|
|
1655
|
+
*/
|
|
1656
|
+
effective_channel_slugs?: Array<string>;
|
|
1657
|
+
/**
|
|
1658
|
+
* Optional tags to organize and filter notification history.
|
|
1659
|
+
* @type {Array<string>}
|
|
1660
|
+
* @memberof LiveActivityUpdateResponse
|
|
1661
|
+
*/
|
|
1662
|
+
tags?: Array<string>;
|
|
1663
|
+
/**
|
|
1664
|
+
* Present when the update started a new Live Activity for a managed stream.
|
|
1665
|
+
* @type {string}
|
|
1666
|
+
* @memberof LiveActivityUpdateResponse
|
|
1667
|
+
*/
|
|
1668
|
+
operation?: string;
|
|
1669
|
+
/**
|
|
1670
|
+
*
|
|
1671
|
+
* @type {string}
|
|
1672
|
+
* @memberof LiveActivityUpdateResponse
|
|
1673
|
+
*/
|
|
1674
|
+
stream_key?: string;
|
|
1675
|
+
/**
|
|
1676
|
+
*
|
|
1677
|
+
* @type {string}
|
|
1678
|
+
* @memberof LiveActivityUpdateResponse
|
|
1679
|
+
*/
|
|
1680
|
+
previous_activity_id?: string;
|
|
1681
|
+
/**
|
|
1682
|
+
* Per-device delivery errors when some devices could not be reached.
|
|
1683
|
+
* @type {Array<string>}
|
|
1684
|
+
* @memberof LiveActivityUpdateResponse
|
|
1685
|
+
*/
|
|
1686
|
+
errors?: Array<string>;
|
|
1513
1687
|
}
|
|
1514
1688
|
/**
|
|
1515
1689
|
* @type LiveActivityValue
|
|
@@ -1690,6 +1864,131 @@ export declare const PushNotificationActionType: {
|
|
|
1690
1864
|
readonly Webhook: "webhook";
|
|
1691
1865
|
};
|
|
1692
1866
|
export type PushNotificationActionType = typeof PushNotificationActionType[keyof typeof PushNotificationActionType];
|
|
1867
|
+
/**
|
|
1868
|
+
* Replacement content. title, subtitle, message, redirection, media, icon, actions, and payload fully replace the original values. Omit metadata or tags to keep the stored values; send {} or [] to clear them.
|
|
1869
|
+
* @export
|
|
1870
|
+
* @interface PushNotificationReplaceRequest
|
|
1871
|
+
*/
|
|
1872
|
+
export interface PushNotificationReplaceRequest {
|
|
1873
|
+
[key: string]: any | any;
|
|
1874
|
+
/**
|
|
1875
|
+
* Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
|
|
1876
|
+
* @type {{ [key: string]: MetadataValue; }}
|
|
1877
|
+
* @memberof PushNotificationReplaceRequest
|
|
1878
|
+
*/
|
|
1879
|
+
metadata?: {
|
|
1880
|
+
[key: string]: MetadataValue;
|
|
1881
|
+
};
|
|
1882
|
+
/**
|
|
1883
|
+
*
|
|
1884
|
+
* @type {string}
|
|
1885
|
+
* @memberof PushNotificationReplaceRequest
|
|
1886
|
+
*/
|
|
1887
|
+
title: string;
|
|
1888
|
+
/**
|
|
1889
|
+
*
|
|
1890
|
+
* @type {string}
|
|
1891
|
+
* @memberof PushNotificationReplaceRequest
|
|
1892
|
+
*/
|
|
1893
|
+
message?: string;
|
|
1894
|
+
/**
|
|
1895
|
+
*
|
|
1896
|
+
* @type {string}
|
|
1897
|
+
* @memberof PushNotificationReplaceRequest
|
|
1898
|
+
*/
|
|
1899
|
+
subtitle?: string;
|
|
1900
|
+
/**
|
|
1901
|
+
* Optional HTTPS image URL without credentials for a custom notification icon. If the image cannot be loaded, the app icon is used. iOS may omit subtitle when displaying a custom icon.
|
|
1902
|
+
* @type {string}
|
|
1903
|
+
* @memberof PushNotificationReplaceRequest
|
|
1904
|
+
*/
|
|
1905
|
+
icon?: string;
|
|
1906
|
+
/**
|
|
1907
|
+
* Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`.
|
|
1908
|
+
* @type {string}
|
|
1909
|
+
* @memberof PushNotificationReplaceRequest
|
|
1910
|
+
*/
|
|
1911
|
+
media?: string;
|
|
1912
|
+
/**
|
|
1913
|
+
* Optional HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require iOS 1.13.4 build 2 or later and an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media.
|
|
1914
|
+
* @type {string}
|
|
1915
|
+
* @memberof PushNotificationReplaceRequest
|
|
1916
|
+
*/
|
|
1917
|
+
redirection?: string;
|
|
1918
|
+
/**
|
|
1919
|
+
* Optional interactive actions shown when users expand the notification. Cannot be combined with `media`.
|
|
1920
|
+
* @type {Array<PushNotificationAction>}
|
|
1921
|
+
* @memberof PushNotificationReplaceRequest
|
|
1922
|
+
*/
|
|
1923
|
+
actions?: Array<PushNotificationAction>;
|
|
1924
|
+
/**
|
|
1925
|
+
*
|
|
1926
|
+
* @type {object}
|
|
1927
|
+
* @memberof PushNotificationReplaceRequest
|
|
1928
|
+
*/
|
|
1929
|
+
payload?: object;
|
|
1930
|
+
/**
|
|
1931
|
+
*
|
|
1932
|
+
* @type {number}
|
|
1933
|
+
* @memberof PushNotificationReplaceRequest
|
|
1934
|
+
*/
|
|
1935
|
+
badge?: number;
|
|
1936
|
+
/**
|
|
1937
|
+
* Optional tags to organize and filter notification history.
|
|
1938
|
+
* @type {Array<string>}
|
|
1939
|
+
* @memberof PushNotificationReplaceRequest
|
|
1940
|
+
*/
|
|
1941
|
+
tags?: Array<string>;
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Apple APNs acceptance result for the replacement. Acceptance does not confirm device delivery or presentation.
|
|
1945
|
+
* @export
|
|
1946
|
+
* @interface PushNotificationReplaceResponse
|
|
1947
|
+
*/
|
|
1948
|
+
export interface PushNotificationReplaceResponse {
|
|
1949
|
+
/**
|
|
1950
|
+
* True when APNs accepts the replacement for at least one device.
|
|
1951
|
+
* @type {boolean}
|
|
1952
|
+
* @memberof PushNotificationReplaceResponse
|
|
1953
|
+
*/
|
|
1954
|
+
success: boolean;
|
|
1955
|
+
/**
|
|
1956
|
+
* ID of the replaced Push Notification. It stays the same, so you can replace it again.
|
|
1957
|
+
* @type {string}
|
|
1958
|
+
* @memberof PushNotificationReplaceResponse
|
|
1959
|
+
*/
|
|
1960
|
+
notification_id: string;
|
|
1961
|
+
/**
|
|
1962
|
+
* Number of device tokens for which APNs accepted the notification, without confirming on-device delivery.
|
|
1963
|
+
* @type {number}
|
|
1964
|
+
* @memberof PushNotificationReplaceResponse
|
|
1965
|
+
*/
|
|
1966
|
+
devices_notified?: number;
|
|
1967
|
+
/**
|
|
1968
|
+
*
|
|
1969
|
+
* @type {number}
|
|
1970
|
+
* @memberof PushNotificationReplaceResponse
|
|
1971
|
+
*/
|
|
1972
|
+
users_notified?: number;
|
|
1973
|
+
/**
|
|
1974
|
+
*
|
|
1975
|
+
* @type {Array<string>}
|
|
1976
|
+
* @memberof PushNotificationReplaceResponse
|
|
1977
|
+
*/
|
|
1978
|
+
effective_channel_slugs?: Array<string>;
|
|
1979
|
+
/**
|
|
1980
|
+
* Optional tags to organize and filter notification history.
|
|
1981
|
+
* @type {Array<string>}
|
|
1982
|
+
* @memberof PushNotificationReplaceResponse
|
|
1983
|
+
*/
|
|
1984
|
+
tags?: Array<string>;
|
|
1985
|
+
/**
|
|
1986
|
+
*
|
|
1987
|
+
* @type {string}
|
|
1988
|
+
* @memberof PushNotificationReplaceResponse
|
|
1989
|
+
*/
|
|
1990
|
+
timestamp: string;
|
|
1991
|
+
}
|
|
1693
1992
|
/**
|
|
1694
1993
|
*
|
|
1695
1994
|
* @export
|
|
@@ -1796,6 +2095,12 @@ export interface PushNotificationResponse {
|
|
|
1796
2095
|
* @memberof PushNotificationResponse
|
|
1797
2096
|
*/
|
|
1798
2097
|
success: boolean;
|
|
2098
|
+
/**
|
|
2099
|
+
* ID of this Push Notification. Pass it to `PUT /push-notification/{notification_id}` to replace the notification later.
|
|
2100
|
+
* @type {string}
|
|
2101
|
+
* @memberof PushNotificationResponse
|
|
2102
|
+
*/
|
|
2103
|
+
notification_id?: string;
|
|
1799
2104
|
/**
|
|
1800
2105
|
* Number of device tokens for which APNs accepted the notification, without confirming on-device delivery.
|
|
1801
2106
|
* @type {number}
|
|
@@ -1826,6 +2131,36 @@ export interface PushNotificationResponse {
|
|
|
1826
2131
|
* @memberof PushNotificationResponse
|
|
1827
2132
|
*/
|
|
1828
2133
|
timestamp: string;
|
|
2134
|
+
/**
|
|
2135
|
+
* Number of device tokens targeted.
|
|
2136
|
+
* @type {number}
|
|
2137
|
+
* @memberof PushNotificationResponse
|
|
2138
|
+
*/
|
|
2139
|
+
devices_targeted?: number;
|
|
2140
|
+
/**
|
|
2141
|
+
* Number of device tokens deactivated because APNs reported them unregistered.
|
|
2142
|
+
* @type {number}
|
|
2143
|
+
* @memberof PushNotificationResponse
|
|
2144
|
+
*/
|
|
2145
|
+
devices_deactivated?: number;
|
|
2146
|
+
/**
|
|
2147
|
+
* Number of targeted device tokens APNs reported as unregistered.
|
|
2148
|
+
* @type {number}
|
|
2149
|
+
* @memberof PushNotificationResponse
|
|
2150
|
+
*/
|
|
2151
|
+
devices_unregistered?: number;
|
|
2152
|
+
/**
|
|
2153
|
+
* True when the request was an integration connection test and no paired devices were available.
|
|
2154
|
+
* @type {boolean}
|
|
2155
|
+
* @memberof PushNotificationResponse
|
|
2156
|
+
*/
|
|
2157
|
+
credential_test?: boolean;
|
|
2158
|
+
/**
|
|
2159
|
+
*
|
|
2160
|
+
* @type {string}
|
|
2161
|
+
* @memberof PushNotificationResponse
|
|
2162
|
+
*/
|
|
2163
|
+
message?: string;
|
|
1829
2164
|
}
|
|
1830
2165
|
/**
|
|
1831
2166
|
*
|
|
@@ -10,6 +10,8 @@ type PushRequestBody = Parameters<PushNotificationsApi["sendPushNotification"]>[
|
|
|
10
10
|
type PushSendParameters = Parameters<PushNotificationsApi["sendPushNotification"]>[0];
|
|
11
11
|
type PushRawParameters = Parameters<PushNotificationsApi["sendPushNotificationRaw"]>[0];
|
|
12
12
|
type SendInitOverrides = Parameters<PushNotificationsApi["sendPushNotification"]>[1];
|
|
13
|
+
type PushReplaceRequestBody = Parameters<PushNotificationsApi["replacePushNotification"]>[0]["pushNotificationReplaceRequest"];
|
|
14
|
+
type PushReplaceParameters = Parameters<PushNotificationsApi["replacePushNotification"]>[0];
|
|
13
15
|
type StartRequestBody = Parameters<LiveActivitiesApi["startLiveActivity"]>[0]["liveActivityStartRequest"];
|
|
14
16
|
type UpdateRequestBody = Parameters<LiveActivitiesApi["updateLiveActivity"]>[0]["liveActivityUpdateRequest"];
|
|
15
17
|
type EndRequestBody = Parameters<LiveActivitiesApi["endLiveActivity"]>[0]["liveActivityEndRequest"];
|
|
@@ -89,6 +91,12 @@ export declare class NotificationsResource {
|
|
|
89
91
|
private readonly api;
|
|
90
92
|
constructor(api: PushNotificationsApi);
|
|
91
93
|
send(request: PushSendRequest, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationResponse>;
|
|
94
|
+
/**
|
|
95
|
+
* Silently replaces a sent Push Notification, using the notification_id returned by send().
|
|
96
|
+
* The replacement takes the original's place on the Lock Screen and in history.
|
|
97
|
+
*/
|
|
98
|
+
replace(notificationId: string, request: PushReplaceRequestBody, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationReplaceResponse>;
|
|
99
|
+
replacePushNotification(requestParameters: PushReplaceParameters, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationReplaceResponse>;
|
|
92
100
|
sendPushNotification(requestParameters: PushSendParameters, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationResponse>;
|
|
93
101
|
sendPushNotificationRaw(requestParameters: PushRawParameters, initOverrides?: SendInitOverrides): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").PushNotificationResponse>>;
|
|
94
102
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActivitySmith = exports.MetricsResource = exports.LiveActivitiesResource = exports.NotificationsResource = void 0;
|
|
4
4
|
const index_1 = require("../generated/index");
|
|
5
|
-
const SDK_VERSION = "1.
|
|
5
|
+
const SDK_VERSION = "1.14.0";
|
|
6
6
|
const SDK_HEADER_NAME = "X-ActivitySmith-SDK";
|
|
7
7
|
const DEFAULT_SDK_NAME = "node";
|
|
8
8
|
const SDK_HEADER_VALUE = `${DEFAULT_SDK_NAME}-v${SDK_VERSION}`;
|
|
@@ -97,6 +97,19 @@ class NotificationsResource {
|
|
|
97
97
|
assertValidPushRequest(normalized);
|
|
98
98
|
return this.api.sendPushNotification({ pushNotificationRequest: normalized }, initOverrides);
|
|
99
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Silently replaces a sent Push Notification, using the notification_id returned by send().
|
|
102
|
+
* The replacement takes the original's place on the Lock Screen and in history.
|
|
103
|
+
*/
|
|
104
|
+
replace(notificationId, request, initOverrides) {
|
|
105
|
+
assertValidPushRequest(request);
|
|
106
|
+
return this.api.replacePushNotification({ notificationId, pushNotificationReplaceRequest: request }, initOverrides);
|
|
107
|
+
}
|
|
108
|
+
// Generated-style alias.
|
|
109
|
+
replacePushNotification(requestParameters, initOverrides) {
|
|
110
|
+
assertValidPushRequest(requestParameters.pushNotificationReplaceRequest);
|
|
111
|
+
return this.api.replacePushNotification(requestParameters, initOverrides);
|
|
112
|
+
}
|
|
100
113
|
// Backward-compatible alias.
|
|
101
114
|
sendPushNotification(requestParameters, initOverrides) {
|
|
102
115
|
assertValidPushRequest(requestParameters.pushNotificationRequest);
|