Skip to content

Commit 62a917f

Browse files
committed
Update README.md
1 parent 1d51751 commit 62a917f

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ Airhorn makes it easy to send SMS, SMTP, Webhooks, and mobile push notifications
3333
* Built using [writr](https://github.org/jaredwray/writr) markdown based content.
3434
* Subscriptions - You can now specify a subscription for a profile and track it. Data is stored in MongoDB and Posgres will be supported soon.
3535

36-
## ESM and Node Version Support
36+
# ESM and Node Version Support
3737

3838
This package is ESM only and tested on the current lts version and its previous. Please don't open issues for questions regarding CommonJS / ESM or previous Nodejs versions. To learn more about using ESM please read this from `sindresorhus`: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
3939

4040

4141
# Library API
4242

43-
### `send()`
43+
## `send()`
4444

4545
The `send()` function, located in `airhorn.ts`, is used to send notifications. It accepts the following parameters:
4646

@@ -51,7 +51,7 @@ The `send()` function, located in `airhorn.ts`, is used to send notifications. I
5151
* `data` (any): The information to pass to the message. This parameter is typically a data object or a string. The data can include the raw message to be sent, or it can be used to populate a message template.
5252
* `languageCode` (string): The language code of the message template to be sent.
5353

54-
### `sendSMTP()`
54+
## `sendSMTP()`
5555

5656
The `sendSMTP()` function, located in `airhorn.ts`, is used to send `SMTP` notifications. It accepts the following parameters:
5757

@@ -61,7 +61,7 @@ The `sendSMTP()` function, located in `airhorn.ts`, is used to send `SMTP` notif
6161
* `data` (any): The information to pass to the message. This parameter is typically a data object or a string. The data can include the raw message to be sent, or it can be used to populate a message template.
6262
* `languageCode` (string): The language code of the message template to be sent.
6363

64-
### `sendSMS()`
64+
## `sendSMS()`
6565

6666
The `sendSMS()` function, located in `airhorn.ts`, is used to send `SMS` notifications. It accepts the following parameters:
6767

@@ -71,7 +71,7 @@ The `sendSMS()` function, located in `airhorn.ts`, is used to send `SMS` notific
7171
* `data` (any): The information to pass to the message. This parameter is typically a data object or a string. The data can include the raw message to be sent, or it can be used to populate a message template.
7272
* `languageCode` (string): The language code of the message template to be sent.
7373

74-
### `sendWebhook()`
74+
## `sendWebhook()`
7575

7676
The `sendWebhook()` function, located in `airhorn.ts`, is used to send `Webhook` notifications. It accepts the following parameters:
7777

@@ -81,7 +81,7 @@ The `sendWebhook()` function, located in `airhorn.ts`, is used to send `Webhook`
8181
* `data` (any): The information to pass to the message. This parameter is typically a data object or a string. The data can include the raw message to be sent, or it can be used to populate a message template.
8282
* `languageCode` (string): The language code of the message template to be sent.
8383

84-
### `sendMobilePush()`
84+
## `sendMobilePush()`
8585

8686
The `sendMobilePush()` function, located in `airhorn.ts`, is used to send `Mobile Push` notifications. It accepts the following parameters:
8787

@@ -91,7 +91,7 @@ The `sendMobilePush()` function, located in `airhorn.ts`, is used to send `Mobil
9191
* `data` (any): The information to pass to the message. This parameter is typically a data object or a string. The data can include the raw message to be sent, or it can be used to populate a message template.
9292
* `languageCode` (string): The language code of the message template to be sent.
9393

94-
### `options`
94+
## `options`
9595

9696
The `AirhornOptions` enables you to configure the settings of Airhorn. It accepts the following parameters:
9797

@@ -121,17 +121,17 @@ const airhorn = new Airhorn({
121121
});
122122
```
123123

124-
### Templates
124+
# Templates
125125

126126
This library supports the use of templates to easily send formatted messages to different providers. Sample templates can be found in `test/templates` within the subdirectories `cool-multi-lingual`, `generic-template-foo`, and `multiple-types-bar`.
127127

128128
By default, `Config` will look for templates at `./templates`. However, this path can be manually adjusted if needed.
129129

130-
#### Language Localization
130+
# Language Localization
131131

132132
With templates, users can easily send messages in different languages. A sample architecture for language localized templates can be found in the `cool-multi-lingual` directory within `test/templates`. This directory contains folders for English and Spanish language codes, 'en' and 'es' respectively. Each of these directories contains SMS, SMTP, and Webhook templates in the appropriate language. To send notifications in a specific language, users can simply provide the appropriate `languageCode` parameter to the `send()` function.
133133

134-
#### Template Overrides
134+
# Template Overrides
135135

136136
When looking at the sample templates, we can see that some of them support word substitution. For example, the generic SMTP template looks like this:
137137

@@ -145,11 +145,11 @@ subject: Generic Hello
145145

146146
To substitute the appropriate text for `firstName`, `lastName`, and `email`, users can provide the appropriate data to the `send()` function. This data is then passed to the template and rendered automatically.
147147

148-
### Examples for using this library
148+
# Examples for using this library
149149

150150
This library can be used to easily send a variety of notifications. In this section, we'll cover how to implement some simple use cases.
151151

152-
#### Sending a simple email
152+
## Sending a simple email
153153

154154
Using the send function, we can email '[email protected]' from '[email protected]' using the generic template 'generic-template-foo'. We'll also use the provider type `AirhornProviderType.SMTP` to indicate that we're sending an email:
155155

@@ -159,7 +159,7 @@ const airhorn = new Airhorn();
159159
await airhorn.send('[email protected]', '[email protected]', 'generic-template-foo', AirhornProviderType.SMTP);
160160
```
161161

162-
#### Sending a simple webhook
162+
## Sending a simple webhook
163163

164164
Here, we'll send a simple webhook to the URL 'https://httpbin.org/post':
165165

@@ -168,7 +168,7 @@ const airhorn = new Airhorn();
168168
airhorn.send('https://httpbin.org/post', 'foo', 'bar', AirhornProviderType.WEBHOOK);
169169
```
170170

171-
#### Using multiple providers
171+
## Using multiple providers
172172

173173
In this example, we'll send a message using multiple email providers:
174174

@@ -197,11 +197,11 @@ This library supports sending notifications via email, SMS, and Mobile Push for
197197

198198
In this section, we'll describe how to use each of these notification services.
199199

200-
### Email providers
200+
## Email providers
201201

202202
This library supports sending emails via AWS SES and Twilio Sendgrid.
203203

204-
#### AWS SES
204+
## AWS SES
205205

206206
After configuring your system to use AWS SES, you can easily use `airhorn` to send emails. In this example, we'll email '[email protected]' from '[email protected]' using the email template 'generic-template-foo'. We'll list the provider type as `AirhornProviderType.SMTP` to indicate that we're sending an email:
207207

@@ -212,7 +212,7 @@ const airhorn = new Airhorn({
212212
await airhorn.send('[email protected]', '[email protected]', 'generic-template-foo', AirhornProviderType.SMTP);
213213
```
214214

215-
#### Twilio Sendgrid
215+
## Twilio Sendgrid
216216

217217
To send emails via Twilio Sendgrid, first update the `TWILIO_SENDGRID_API_KEY` value via `AirhornOptions`. Then, we can use the same syntax as above to send an email through Twilio Sendgrid:
218218

@@ -223,7 +223,7 @@ const airhorn = new Airhorn({
223223
await airhorn.send('[email protected]', '[email protected]', 'generic-template-foo', AirhornProviderType.SMTP);
224224
```
225225

226-
### SMS providers
226+
## SMS providers
227227

228228
This library supports sending SMS using AWS SMS and Twilio.
229229

@@ -250,7 +250,7 @@ const airhorn = new Airhorn({
250250
await airhorn.send('5555555555', '5552223333', 'Test message text', AirhornProviderType.SMS);
251251
```
252252

253-
### Mobile push providers
253+
## Mobile push providers
254254

255255
This library supports sending Mobile Push notifications using AWS SNS and Google Firebase.
256256

@@ -287,11 +287,11 @@ const airhorn = new Airhorn({
287287
await airhorn.send('endpointArn', '', 'generic-template-foo', AirhornProviderType.MOBILE_PUSH);
288288
```
289289

290-
## How to Contribute
290+
# How to Contribute
291291

292292
Now that you've set up your workspace, you're ready to contribute changes to the `airhorn` repository you can refer to the [CONTRIBUTING](CONTRIBUTING.md) guide. If you have any questions please feel free to ask by creating an issue and label it `question`.
293293

294-
## Setting up your Development Environment
294+
# Setting up your Development Environment
295295

296296
To set up your development environment, you'll need the following dependencies:
297297
* Node.js (latest)
@@ -318,6 +318,6 @@ If you are using `nvm` you can run the following:
318318
nvm use && npm i && npm run test:services:start && npm test
319319
```
320320

321-
## Licensing
321+
# Licensing
322322

323323
This project is licensed under [MIT](LICENSE) and copyright by Jared Wray 2021-future.

0 commit comments

Comments
 (0)