Skip to content

getnacelle/dim-cf-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Integrity Monitor/Alerts via Cloudflare Worker

General Info

This repo is an example to implementing alerts in Slack with Cloudflare Workers when data differs between two different API sources (ie. Nacelle & Shopify). The key benefit of this is to alert when data does not match and when a sync (or reindex) is required. In order to implement this repo for your own needs, it is recommended to use Cloudflare's Wrangler CLI to edit and deploy the Cloudflare Worker.

This worker uses multiple cron triggers (in a single Cloudflare Worker) to trigger different checks:

  • Total collection count
  • Total product count
  • Count of products in specified list of collections
    • The list of collections must be specified in countProductsInCollections.js.

Environment Variables

Environment variables can be setup in the Cloudflare Dashboard or in the wrangler.toml file as documented here.

  • SHOPIFY_ENDPOINT
  • NACELLE_ENDPOINT
  • SLACK_WEBHOOK_URL
  • SHOPIFY_ADMIN_ENDPOINT
  • SHOPIFY_STOREFRONT_TOKEN
  • SHOPIFY_ADMIN_TOKEN

Working with Wrangler

Please see relevant documentation.

Additional Notes

Be sure to use the access tokens that correspond to the same level of access in the source and destination system. For validating between Shopify & Nacelle, you would use the same Shopify storefront access token and admin token that is being used for the Shopify connector in the Nacelle dashboard.

Please see Slack documentation on setting up incoming webhooks. The 'Incoming Webhook URL' is the appropriate endpoint to use for the env variable.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published