alkemio-notifications
v0.16.0
Published
Alkemio notifications service
Downloads
2
Readme
notifications
Alkemio out-of-band notifications service.
To test
- Start quickstart-services from the server repo with defaults.
- Start mailslurper:
npm run start:services
- Go to http://localhost:15672/#/queues/%2F/alkemio-notifications.
- Under publish message, go to
properties
and add a new property with namecontent_type
and valueapplication/json
. - Select payload:
{
"data": "YOUR_DATA"
}
- Click publish.
- Navigate to http://localhost:5051/mailcount. You will see mailCount > 0 (mailslurper will reset the count on each restart).
- Navigate to http://localhost:5051/mail. Search for YOUR_DATA. You will find it in the mail message.
Templates
To add a template:
- Create a file under src/templates.
- Copy welcome.js
- Change the template name
- Define your channels. You can use this as an example.
- In the file you want to use the template, import nunjucks and notifme-template.
- Render your template
const notification = await render('template_name', payload, 'en-US');
- Send notification
await notifmeSdk.send(notification.channels).then(console.log);
To test the welcome (sample) template, you can use the following payload in RabbitMQ Management UI
{
"pattern": "communityApplicationCreated",
"data": {
"applicantionCreatorID": "f0a47bad-eca5-4942-84ac-4dc9f085b7b8",
"applicantID": "f0a47bad-eca5-4942-84ac-4dc9f085b7b8",
"community": {
"name": "02 Zero Hunger",
"type": "challenge"
},
"space": {
"id": "32818605-ef2f-4395-bb49-1dc2835c23de",
"challenge": {
"id": "7b86f954-d8c3-4fac-a652-b922c80e5c20",
"opportunity": {
"id": "636be60f-b64a-4742-8b50-69e608601935"
}
}
}
}
}
Note: replace applicantionCreatorID, applicantID, and space + challenge + opportunity IDs with IDs you have in your database. You can run the following gql queries to find them:
query {
spaces {
id
displayName
challenges {
id
displayName
nameID
community {
id
displayName
}
opportunities {
displayName
id
}
}
}
}
query {
me {
id
}
}