forked from novuhq/novu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
319 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Ignore artifacts: | ||
build | ||
coverage | ||
package.json | ||
yarn.lock | ||
*.md | ||
.docusaurus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Quick Start | ||
|
||
To create your free managed or docker based Novu environment use our CLI tool: | ||
|
||
```shell | ||
npx novu init | ||
``` | ||
|
@@ -15,7 +13,7 @@ After creating your cloud or self-hosted account the next steps to sending your | |
- Connect your providers | ||
- Create a notification template | ||
- Send a trigger | ||
- Integrate the Notification Center within your app _(optional)_ | ||
- Integrate the Notification Center within your app *(optional)* | ||
|
||
## Connect providers | ||
|
||
|
@@ -43,6 +41,7 @@ You can specify the content for email in two ways: | |
|
||
**Visual template builder** - For simple usecases you can use our visual template editor with limited control over design but easier to get-started. | ||
|
||
|
||
**Custom Code** - You can use the custom code section to specify custom html that will be used for the email. | ||
|
||
You can specify custom variables using the [{{handlebars}}](https://handlebarsjs.com/guide/) syntax. | ||
|
@@ -60,41 +59,42 @@ In the notification center preview you can type the content, you can select cont | |
After creating the template trigger will be generated, use the server SDK in your application in the appropriate place for the specific trigger. | ||
|
||
```typescript | ||
await novu.trigger('<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL>', { | ||
to: { | ||
subscriberId: '<USER_IDENTIFIER>', | ||
email: '[email protected]', | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
}, | ||
payload: { | ||
customVariables: 'Hello', | ||
}, | ||
}); | ||
await novu.trigger('<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL>', | ||
{ | ||
to: { | ||
subscriberId: '<USER_IDENTIFIER>', | ||
email: '[email protected]', | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
}, | ||
payload: { | ||
customVariables: 'Hello' | ||
}, | ||
} | ||
); | ||
``` | ||
|
||
The trigger function contains a parameters object as the second parameter. Let's explore it's different options: | ||
|
||
### `to` key | ||
|
||
The `to` parameter contains the information about the subscriber of the notification, you can work with Novu in 2 modes: | ||
|
||
#### Pass the subscriber information in trigger (Quickest) | ||
|
||
You can pass the subscriber object containing the following keys as this paramter: | ||
|
||
```typescript | ||
await novu.trigger('<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL>', { | ||
to: { | ||
subscriberId: 'Unique Subscriber Identifier', | ||
firstName, | ||
lastName, | ||
email, | ||
phone, | ||
avatar, | ||
}, | ||
payload: {}, | ||
}); | ||
await novu.trigger('<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL>', | ||
{ | ||
to: { | ||
subscriberId: 'Unique Subscriber Identifier', | ||
firstName, | ||
lastName, | ||
email, | ||
phone, | ||
avatar | ||
}, | ||
payload: {} | ||
} | ||
); | ||
|
||
``` | ||
|
||
The `subscriberId` is a custom identifier used when identifying your users within the Novu platform. We suggest using your internal DB identifier for this field. | ||
|
@@ -103,17 +103,15 @@ Novu will create an upsert command and either create a subscriber with specified | |
|
||
**Note:** The api will perform a PATCH command, updating only the fields passed to it. So in order to reset a specific field you must explicitly pass `null` as the fields param. | ||
|
||
#### Pass only the subscriberId (Recommended) | ||
|
||
#### Pass only the subscriberId (Recommended) | ||
```typescript | ||
{ | ||
to: 'SUBSCRIBER_ID', | ||
payload: {} | ||
} | ||
``` | ||
|
||
In this approach, you will only pass the subscriberId as part of the trigger, however it will require you to identify the subscriber using the `identify` method from the `@novu/node` library. | ||
|
||
### `payload` object | ||
|
||
Can pass any serializible JSON object to be used in the notification templates. | ||
Can pass any serializible JSON object to be used in the notification templates. |
Oops, something went wrong.