Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
Change integrations.create to integrations.ready
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Oct 28, 2021
1 parent e92d3d6 commit 825e89b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This integration does the following things:

* Disable default Chec emails (on `integrations.create` event, first run only)
* Disable default Chec emails (on `integrations.ready` event, first run only)
* Create transactional email templates in SendGrid, unless a template ID was provided for each email type
* Assemble data for transactional emails and send them using the SendGrid API

Expand Down Expand Up @@ -32,15 +32,15 @@ npm run build
| Event | Action | Template |
| -------------------------- | ----------------------------------- | ---------------------- |
| `readiness.probe` | API checking on readiness | - |
| `integrations.create` | Initial setup | - |
| `integrations.ready` | Initial setup | - |
| `orders.create` | Send customer receipt | "Order receipt" |
| `orders.physical.shipment` | Send customer shipment notification | "Item shipped" |
| `customers.login.token` | Send customer login token | "Customer login token" |

## Initial setup

When the integration first runs, it will run an initial setup phase. This is triggered by the event being
"integrations.create", which only runs for an integration at the time it is created. We can assume the integration
"integrations.ready", which only runs for an integration at the time it is created. We can assume the integration
has been provisioned at this point, however DNS may not be available for it yet.

The initial setup process does the following:
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module.exports = async function handler(request, context) {
switch (data.event) {
// Runs once when an integration is first installed. Use this to control initial setup steps such as disabling
// default emails in the Chec API, etc.
case 'integrations.create':
case 'integrations.ready':
// Disable default emails in Chec
context.api.put(`/v1/merchants/${merchantId}/notifications`, {
customer: {
Expand Down

0 comments on commit 825e89b

Please sign in to comment.