This example demonstrates how you can create short order IDs by using webhooks.
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, youʼll want to add the integration through the Dashboard. The URL is the one provided by
Download the example
Clone the repository:
git clone email@example.com:moltin/integration-examples.git
Install the dependencies with Yarn:
cd integration-examples/short-order-id yarn
You xan extend core resources with the Flows API. From inside the Dashboard, head to Settings > Flows.
Here you want to create a new Flow (or edit if it already exists) for extending products. Give it a name and description, and make sure the
slug is set to
Next, create a new Field for the Flow you just created.
Give the new Field a name and description you recognize. Make sure the
slug is set to
short_id as this is what the serverless function cloned defined previously expects.
Save this Field.
.env inside the directory
/short-order-id containing all the keys for the following environment variables:
MOLTIN_CLIENT_ID= MOLTIN_CLIENT_SECRET= MOLTIN_WEBHOOK_SECRET=
MOLTIN_WEBHOOK_SECRET can be anything you want.
Start the server and ngrok
Start the development server
The server typically starts on port 3000. If not, make a note for the next step.
ngrok http 3000
This exposes port 3000 to the outside world. Make a note of the URL ngrok provides.
Create a new integration
You must now enter the ngrok URL defined previously. 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
Finally, youʼll want to configure this webhook to be invoked when an order is Created.