@ariary/notification 3.0.5 → 3.0.6
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 +49 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,19 @@ Ariari.config({
|
|
|
23
23
|
|
|
24
24
|
`Ariari.send()` accepts one or more messages. Phone numbers are automatically normalized (`+261340000000`, `261340000000`, `0340000000` all work).
|
|
25
25
|
|
|
26
|
+
Each message has the following shape:
|
|
27
|
+
|
|
28
|
+
| Field | Type | Required | Description |
|
|
29
|
+
|---|---|---|---|
|
|
30
|
+
| `phone` | string \| string[] | Yes | Recipient phone number(s) |
|
|
31
|
+
| `message` | string | Yes | SMS content |
|
|
32
|
+
|
|
33
|
+
You can also pass a `SendOptions` object as the first argument:
|
|
34
|
+
|
|
35
|
+
| Field | Type | Required | Description |
|
|
36
|
+
|---|---|---|---|
|
|
37
|
+
| `scheduledAt` | string | No | ISO date to schedule the SMS |
|
|
38
|
+
|
|
26
39
|
```ts
|
|
27
40
|
// single recipient
|
|
28
41
|
const task = await Ariari.send({ phone: '0340000000', message: 'Hello!' })
|
|
@@ -41,6 +54,42 @@ const task = await Ariari.send(
|
|
|
41
54
|
|
|
42
55
|
`send()` returns a `Task` object. Call `.status()` to check delivery progress.
|
|
43
56
|
|
|
57
|
+
### `task.status()` — TaskStatus
|
|
58
|
+
|
|
59
|
+
| Field | Type | Description |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `total` | number | Total SMS count |
|
|
62
|
+
| `sent` | number | Successfully sent |
|
|
63
|
+
| `failed` | number | Failed to send |
|
|
64
|
+
| `delivered` | number | Confirmed delivered |
|
|
65
|
+
|
|
66
|
+
### `task.status(count, page?)` — TaskWithDetails
|
|
67
|
+
|
|
68
|
+
| Field | Type | Description |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| `task` | TaskResponse | Task metadata (see below) |
|
|
71
|
+
| `sms` | SmsDetail[] | List of SMS details |
|
|
72
|
+
| `total` | number | Total SMS count |
|
|
73
|
+
|
|
74
|
+
### TaskResponse
|
|
75
|
+
|
|
76
|
+
| Field | Type | Description |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `_id` | string | Task ID |
|
|
79
|
+
| `status` | TaskStatus | Delivery counters |
|
|
80
|
+
| `createdAt` | string | Creation date |
|
|
81
|
+
| `scheduledAt` | string? | Scheduled date |
|
|
82
|
+
|
|
83
|
+
### SmsDetail
|
|
84
|
+
|
|
85
|
+
| Field | Type | Description |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `smsId` | string | SMS ID |
|
|
88
|
+
| `phone` | string | Recipient phone number |
|
|
89
|
+
| `message` | string | SMS content |
|
|
90
|
+
| `status` | SmsStatus | `SCHEDULED` \| `PENDING` \| `SENT` \| `DELIVERED` \| `FAILED` |
|
|
91
|
+
| `retryCount` | number | Number of retry attempts |
|
|
92
|
+
|
|
44
93
|
```ts
|
|
45
94
|
const task = await Ariari.send({ phone: '0340000000', message: 'Hello!' })
|
|
46
95
|
|