Add/Update a Algolia indexed object when an object is created or modified in moltin
Built with Micro! 🤩
.env at the project root with the following credentials:
MOLTIN_AGOLIA_INDICES is optional but it is used to restrict which Moltin objects to generate Algolia indices for (ie.
MOLTIN_CLIENT_SECRET inside of your moltin Dashboard's API keys.
MOLTIN_WEBHOOK_SECRET can be anything you want.
ALGOLIA_API_KEY within your Algolia Dashboard by going to
API keys for your App. Note,
ALGOLIA_API_KEY should be set to your Algolia
Admin API Key, not your
Search-Only API Key.
Run the following command to build the app
Start the development server
The server will typically start on PORT
3000, if not, make a note for the next step.
Start ngrok (change ngrok port below from 3000 if yarn dev deployed locally on different port above)
ngrok http 3000
Make a note of the https
ngrok URL provided.
Next head over to the moltin Webhook Settings area, add a new integration (
Settings > Integrations and click
Enter any name and description for your Integration. Moltin recommends you prefix the name with
DEVELOPMENT: for any testing.
Next, enter the
ngrok URL from above and
MOLTIN_WEBHOOK_SECRET that you saved inside
Now finally you'll want to configure what Moltin Observables (ie.
Products, Brands, Categories, Collections, Orders, Customers) will cause this webhook to be invoked. In this example we want to monitor the
Customers observables and select the
Click Save to register your new Webhook with Moltin.
NOTE: this repository is based on a fantastic set of code from our partners at moltin, available at: https://github.com/moltin/integration-examples/tree/master/sync-catalog-to-algolia
You can easily deploy this function to now.