In this example, we clone and configure the repository containing the code necessary to synchronize data between Elastic Path Commerce Cloud and Algolia by using webhooks.
- Prepare to run the example locally
- Download the example
- Configure Algolia
- Configure your environment variables
- Create a new integration
Prepare to run the example locally
When using this example locally, itʼs recommended you use a service ngrok to tunnel your dev environment to the outside world.
After you have the repo running locally, add the integration through the Dashboard. The URL will be the one provided by ngrok.
Download the example
Clone the repository:
git clone email@example.com:moltin/integration-examples.git
Install the dependencies with Yarn
cd integration-examples/sync-catalog-to-algolia yarn
In this example, we synchronize data to Algolia. After you sign up to Algolia, you need to create a new app and give it a name.
Next head to the API keys section and make a note of your Application ID and Admin API Key, we will need these next.
Configure your environment variables
You will want to create an .env inside the directory
/short-order-id containing all the keys for the below:
MOLTIN_WEBHOOK_SECRET can be anything you want.
Start the server and ngrok
Start the development server
The server will typically start on port 3000. If not, make a note for the next step.
ngrok http 3000
This will expose port 3000 to the outside world. Make a note of the URL ngrok provides.
Create a new integration
You must now tell Commerce Cloud the ngrok URL above. From within the Dashboard, head to Settings > Integrations and click Create.
Enter a name and description for your integration. It might be useful to prefix the name with
DEVELOPMENT for easier referencing.
Next, enter the ngrok URL and Secret Key that matches that inside
Now youʼll want to configure this webhook to invoke your serverless function when any of the catalog resources are created, updated, or deleted.