...
Table of Contents | ||||
---|---|---|---|---|
|
1. Setting up the ecosystem for development
1.1. Configuring Connec! to send Webhooks to the Impac! bolt notifications router
/wiki/spaces/DEV/pages/90439768
...
Now your Bolt should be subscribed to Connec! webhooks and will receive all further data syncs.
1.2. Register the Impac! Finance Bolt with Impac!
The Impac! API has a database with a Bolt model that triggers the generation of credentials when it is created. ( before_validation :generate_credentials!, on: :create )
...
These credentials are only returned when the bolt is created (after which they are encrypted for the database), so save them!
1.3. Add Impac! credentials to the Impac! Finance Bolt to allow requests from Impac!
You must register the bolt using the keys generated above as the “IMPAC_KEY” and “IMPAC_SECRET” in the Finance Bolt application.yml
...
Code Block | ||
---|---|---|
| ||
ROOT_KEY = # From MnoHub: SystemIdentity.first.api_key ROOT_SECRET = # From MnoHub: SystemIdentity.first.api_secret IMPAC_KEY = # From Impac: the api_key generated when your bolt is created *see above IMPAC_SECRET = # From Impac: the api_secret generated when your bolt is created *see above # These are the Maestrano account pusher keys for development environments PUSHER_APP_ID: '277973' PUSHER_KEY: '67da20b2dc7a407dc522' PUSHER_SECRET: '7fc40a6e8a78bf9ecf1d' OPENEXCHANGERATES_APP_ID: d8091e280ec44002ae37ede2a63167d2 |
1.4. Populating the Impac! Finance Bolt with data
As of right now, nothing has been implemented to make sure the Bolt is up to date with Connec!, so if the Bolt is linked up after data has already been synced with Connec!, it will miss out on the webhooks and will have nothing in its own database.
...
Code Block | ||
---|---|---|
| ||
channel_id = 'org-fbbj' [Entity::Account, Entity::Company, Entity::Invoice, Entity::Journal].each do |klass| k = klass.to_s.demodulize.pluralize k = 'Company' if k == Entity::Company klass.on_channel(channel_id).all.each do |entity| args = { messages: [ { channel_id: channel_id, entity: k, id: entity.id.to_s }.to_json ], webhook_id: "5989cc91251fe7107052547e" } Webhooks::Notifier.notify(args) end end |
2. Building your first Bolt Widget
The dashboard service in Impac! Angular fetches the widgets from the Impac! Finance Bolt with a request to /api/v2/maestrano/finance/widgets/.
...