@stacksjs/notifications 0.44.10 → 0.44.12
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 +205 -30
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,60 +1,227 @@
|
|
|
1
1
|
# Stacks Notifications
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Stacks Notifications is a unified driver system for sending messages/notifications. It supports sending emails, SMS messages, and chat messages.
|
|
4
4
|
|
|
5
5
|
## ☘️ Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- 📦 Send Emails
|
|
8
|
+
- 🎨 Email Styling
|
|
9
|
+
- 📱 Send SMS messages
|
|
10
|
+
- 💬 Send Chat messages
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
## TODO
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
- [ ] Driver: FCM
|
|
15
|
+
- [ ] Driver: Expo
|
|
16
|
+
- [ ] Driver: SNS (Push)
|
|
17
|
+
- [ ] Driver: Pushwoosh
|
|
12
18
|
|
|
13
19
|
## 🤖 Usage
|
|
14
20
|
|
|
15
|
-
wip
|
|
16
|
-
|
|
17
21
|
```bash
|
|
18
22
|
pnpm i -D @stacksjs/notifications
|
|
19
23
|
```
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
You may now use it in your project:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { notification } from '@stacksjs/notifications'
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
notification.send(options)
|
|
31
|
+
```
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
## 🏎️ Drivers
|
|
34
|
+
|
|
35
|
+
There are different option types for Chat, Email, and SMS drivers. To use any driver, simply configure the notification `options` object.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
interface ChatOptions {
|
|
39
|
+
webhookUrl: string
|
|
40
|
+
content: string
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface EmailOptions {
|
|
44
|
+
to: string | string[]
|
|
45
|
+
subject: string
|
|
46
|
+
html: string
|
|
47
|
+
from?: string
|
|
48
|
+
text?: string
|
|
49
|
+
attachments?: IAttachmentOptions[]
|
|
50
|
+
id?: string
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface SMSOptions {
|
|
54
|
+
to: string
|
|
55
|
+
content: string
|
|
56
|
+
from?: string
|
|
57
|
+
attachments?: IAttachmentOptions[]
|
|
58
|
+
id?: string
|
|
59
|
+
}
|
|
27
60
|
```
|
|
28
61
|
|
|
29
|
-
|
|
62
|
+
Available drivers are listed below, with the proper variables needed to get started.
|
|
30
63
|
|
|
31
64
|
### Email
|
|
32
65
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
66
|
+
Email drivers are configured with the following environment variables:
|
|
67
|
+
|
|
68
|
+
#### Sendgrid
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
SENDGRID_API_KEY=SG123
|
|
72
|
+
SENDGRID_FROM=from@example.com
|
|
73
|
+
SENDGRID_SENDER_NAME=Sender
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### Mailgun
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
MAILGUN_API_KEY=MG123
|
|
80
|
+
MAILGUN_DOMAIN=example.com
|
|
81
|
+
MAILGUN_USERNAME=username
|
|
82
|
+
MAILGUN_FROM=from@example.com
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### Mailjet
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
MAILJET_API_KEY=MJ123
|
|
89
|
+
MAILJET_API_SECRET=MJTESTSECRET
|
|
90
|
+
MAILJET_FROM_EMAIL=from@example.com
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Netcore
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
NETCORE_API_KEY=NC123
|
|
97
|
+
NETCORE_FROM=from@example.com
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Nodemailer
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
NODEMAILER_FROM_EMAIL=from@example.com
|
|
104
|
+
NODEMAILER_HOST=example.com
|
|
105
|
+
NODEMAILER_USERNAME=username
|
|
106
|
+
NODEMAILER_PASSWORD=password
|
|
107
|
+
NODEMAILER_PORT=25
|
|
108
|
+
NODEMAILER_SECURE=true
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### Postmark
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
POSTMARK_API_KEY=PM123
|
|
115
|
+
POSTMARK_FROM=from@example.com
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### AWS SES
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
SES_REGION=US
|
|
122
|
+
SES_ACCESS_KEY_ID=testkey123
|
|
123
|
+
SES_SECRET_ACCESS_KEY=testaccesskey123
|
|
124
|
+
SES_FROM=from@example.com
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Mandrill
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
MANDRILL_API_KEY=Ma123
|
|
131
|
+
MANDRILL_EMAIL=from@example.com
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### EmailJS
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
EMAILJS_FROM_EMAIL=from@example.com
|
|
138
|
+
EMAILJS_HOST=example.com
|
|
139
|
+
EMAILJS_USERNAME=username
|
|
140
|
+
EMAILJS_PASSWORD=password
|
|
141
|
+
EMAILJS_PORT=25
|
|
142
|
+
EMAILJS_SECURE=true
|
|
143
|
+
```
|
|
42
144
|
|
|
43
145
|
### SMS
|
|
44
146
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
147
|
+
SMS drivers are configured with the following environment variables:
|
|
148
|
+
|
|
149
|
+
#### Twilio
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
TWILIO_ACCOUNT_SID=ACtest
|
|
153
|
+
TWILIO_AUTH_TOKEN=testtoken
|
|
154
|
+
TWILIO_FROM_NUMBER=+112345
|
|
155
|
+
TWILIO_TO_NUMBER=+145678
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### Nexmo
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
VONAGE_API_KEY=VN123
|
|
162
|
+
VONAGE_API_SECRET=testkey
|
|
163
|
+
VONAGE_FROM_NUMBER=+112345
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### Gupshup
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
GUPSHUP_USER_ID=GU123
|
|
170
|
+
GUPSHUP_PASSWORD=password
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### Plivo
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
PLIVO_ACCOUNT_ID=PA123
|
|
177
|
+
PLIVO_AUTH_TOKEN=testtoken
|
|
178
|
+
PLIVO_FROM_NUMBER=+112345
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### SMS77
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
SMS77_API_KEY=SA123
|
|
185
|
+
SMS77_FROM=from@example.com
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### SNS
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
SMS77_API_KEY=SA123
|
|
192
|
+
SMS77_FROM=from@example.com
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### Telnyx
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
TELNYX_API_KEY=TA123
|
|
199
|
+
TELNYX_MESSAGE_PROFILE_ID=testprofileid
|
|
200
|
+
TELNYX_FROM=from@example.com
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Termii
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
TERMII_API_KEY=TermA123
|
|
207
|
+
TERMII_SENDER=from@example.com
|
|
208
|
+
```
|
|
53
209
|
|
|
54
210
|
### Chat
|
|
55
211
|
|
|
56
|
-
|
|
57
|
-
|
|
212
|
+
Chat drivers are configured with the following environment variables:
|
|
213
|
+
|
|
214
|
+
#### Discord
|
|
215
|
+
|
|
216
|
+
- None
|
|
217
|
+
|
|
218
|
+
#### Slack
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
SLACK_APPLICATION_ID=SAID123
|
|
222
|
+
SLACK_CLIENT_ID=SCID123
|
|
223
|
+
SLACK_SECRET_KEY=SSK123
|
|
224
|
+
```
|
|
58
225
|
|
|
59
226
|
Learn more in the docs.
|
|
60
227
|
|
|
@@ -82,6 +249,14 @@ For casual chit-chat with others using this package:
|
|
|
82
249
|
|
|
83
250
|
[Join the Stacks Discord Server](https://discord.ow3.org)
|
|
84
251
|
|
|
252
|
+
## 🙏🏼 Credits
|
|
253
|
+
|
|
254
|
+
Many thanks to the following core technologies & people who have contributed to this package:
|
|
255
|
+
|
|
256
|
+
- [Chris Breuer](https://github.com/chrisbbreuer)
|
|
257
|
+
- [Novu](https://novu.co/)
|
|
258
|
+
- [All Contributors](../../contributors)
|
|
259
|
+
|
|
85
260
|
## 📄 License
|
|
86
261
|
|
|
87
262
|
The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/notifications",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.44.
|
|
4
|
+
"version": "0.44.12",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "The Stacks notifications integration.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -68,16 +68,16 @@
|
|
|
68
68
|
"@novu/telnyx": "^0.9.0",
|
|
69
69
|
"@novu/termii": "^0.9.0",
|
|
70
70
|
"@novu/twilio": "^0.9.0",
|
|
71
|
-
"@stacksjs/cli": "0.44.
|
|
72
|
-
"@stacksjs/config": "0.44.
|
|
73
|
-
"@stacksjs/error-handling": "0.44.
|
|
74
|
-
"@stacksjs/types": "0.44.
|
|
71
|
+
"@stacksjs/cli": "0.44.12",
|
|
72
|
+
"@stacksjs/config": "0.44.12",
|
|
73
|
+
"@stacksjs/error-handling": "0.44.12",
|
|
74
|
+
"@stacksjs/types": "0.44.12"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"mkdist": "^1.0.0",
|
|
78
78
|
"typescript": "^4.9.4",
|
|
79
79
|
"unbuild": "^1.0.2",
|
|
80
|
-
"@stacksjs/testing": "0.44.
|
|
80
|
+
"@stacksjs/testing": "0.44.12"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "unbuild",
|