code | type | title | description | order |
---|---|---|---|---|
false |
page |
Overview |
Overview of the Hermes Messenger plugin features and main concepts |
100 |
This plugin gives the application the ability to send various types of messages (SMS, email) using external providers.
Available providers SMS providers:
- Twilio
Available email providers:
- Sendgrid
- SMTP
It is possible to register differents accounts for each provider. Then API actions used to send messages can be used with different accounts.
In this way, several accounts with differents credentials can be used to send messages.
The following API actions can be used to manipulate accounts for each providers:
hermes/*:addAccount
(e.g. hermes/twilio:addAccount)hermes/*:removeAccount
(e.g hermes/twilio:removeAccount)hermes/*:listAccounts
(e.g hermes/twilio:listAccounts)
Accounts can be setup programmaticaly after the application has started by using the addAccount
method.
Clients are available from getters on the plugin instance.
app.start()
.then(() => {
// Add a "common" Twilio account
hermesMessengerPlugin.clients.twilio.addAccount('common', 'accountSid', 'authToken', '+33629951621');
// Add a "common" Sendgrid account
hermesMessengerPlugin.clients.sendgrid.addAccount('common', 'apiKey', 'amaret@kuzzle.io');
// Add a "common" SMTP account
hermesMessengerPlugin.clients.smtp.addAccount('common', 'smtp.example.com', 587, 'dummyUser', 'dummyPass', 'amaret@kuzzle.io');
})
.catch(console.error);