<center>![bts-notifier.png](https://ipfs.busy.org/ipfs/QmZx2R4hPpV4eKy75qJVPMS8fN6pY3PzLPA3zRibUhapGt)
</center>
I sincerely believe that the popularity of the platform is correlated with the ease with which it is used. This also applies to writing software products for BitShares. Thus, I set myself the goal of reducing the barrier for programmers to enter the world of BitShares. The first stage was the implementation of `btsdex.js` oriented primarily to traders. But the subscription to change the account realized there seemed to me rather convenient not only for trading, but also for notification via third-party services. For example, I implemented [bts-notifier](https://github.com/scientistnik/bts-notifier), which will tell if in your account there will be a transfer of funds, creating order or fill order. On the basis of it you can build a notifier for email, Slack and other similar services.
For my part, I will do everything in my power to make this bot work consistently and stably. But all this I draw attention to, that this bot is only an example of use not intended for industrial use.
## <center>How to check it out</center>
To try it out in work, just find the bot in the telegraph [@btsnotifierbot](https://t.me/btsnotifierbot).
<center>![DeepinScreenshot_select-area_20180526210649.png](https://ipfs.busy.org/ipfs/QmPUdmcWHry4J92tH4qQQVBzxd54Cq4crXpERERUkwCAhE)</center>
Add tracking account
<center>![DeepinScreenshot_select-area_20180526210949.png](https://ipfs.busy.org/ipfs/QmVcqt2Dd6V243Ly6cT6damPFihaHNVESXHU8Ke8ZG23mN)</center>
and wait until something happens)
<center>![DeepinScreenshot_select-area_20180526210850.png](https://ipfs.busy.org/ipfs/QmR1Ax6NoFY5offW69bLPXoQYNyttZUPdfpqJWr78Xz4ce)</center>
## <center>Implementation</center>
Logic of the bot itself is divided into two files `database.js` and` main.js`. Most likely it is already clear from the name that in `database.js` is the logic of storing information about subscriptions. The main logic is in `main.js`. The settings for the entire program are in `config.js`.
After the startup, the program connects to the BitShares blockchain, sets up telegram notifications, and starts waiting for either messages from the telegram or changes in the BitShares account being tracked.
I used the packages:
- `btsdex` for working with blockchain,
- `telegraf` for working with telegram,
- `i18n` for multilanguage application.
`btsdex` is used very simply:
```js
const
BitShares = require ('btsdex'),
...
BitShares.init (config.node);
BitShares.subscribe ('connected', start); // after establishing the connection, call start
async function start () {
...
BitShares.subscribe ('account', funcs [acc], acc); // subscription to acc account
...
}
```
`telegraf` is also quite easy to use:
```js
async function start () {
...
bot = new Telegraf (config.telegram.token)
bot.start (greeting) // call the function greeting if the bot wrote `/ start`
bot.hears (I18n.match ('menu.add_account'), addWaitAcc) // if someone wanted to add an account to call addWaitAcc
bot.hears (I18n.match ('menu.remove_account'), removeWaitAcc)
bot.hears (I18n.match ('menu.show_accounts'), showAcc)
bot.hears (I18n.match ('menu.settings'), settings)
bot.action ('cancel_wait_sub', cancelSub)
bot.action (/ remove _. * /, removeSub)
bot.on ('text', getText) // call getText if nothing above matches
bot.startPolling () // get started
}
```
`i18n` is also nothing complicated:
```js
async function start () {
...
i18n = new I18n ({
directory: `$ {__ dirname} / locales`,
defaultLanguage: 'en'
})
bot.use (i18n.middleware ())
}
// further everywhere where there is i18n.t ('here-some-text') - this is the localization of 'here-some-text'
```
All source code is available under the MIT license for [github](https://github.com/scientistnik/bts-notifier). So, quietly fork-up, modify and create your amazing services in the BitShares community.
Until a new meeting!