Create short order IDs
This example provides instructions to create short order IDs using webhooks.
- Ensure that you have an account in the ngrok service to tunnel your development environment externally.
- Ensure that yarn and other dependencies are installed.
Run the following command to clone the repository:
git clone https://github.com/moltin/examples.git
Create a new flow by doing the following:
- In Commerce Manager, go to Flows.
- Click New Flow.
- In the Create New Flow page, enter a name and set the slug to products.
- Enter a description for the flow.
- Select Enabled.
- Click Save.
Create a new field for the flow by doing the following:
Click the flow you have created on the Flows page.
Click New Field.
In Field type, select one of the following options: - Boolean - Float - Integer - String - Date - Relationship
- Enter a name for the new field.
- Set the Slug to short_id.
- Enter a description for the flow field.
- Select the Required field?.
- Enter the Default Value and number of Order.
In the Validation section, select the String Validation Type and enter the valid string options.
In the terminal, go to the
.envfile in the
/short-order-iddirectory and add the keys for the following environment variables:
Use any value that you want for
Run the following command to start the development server:
By default, the server starts on port 3000. If the server starts on a different port, then use that port number in the next step.
Run the following command to start ngrok:
ngrok http 3000
This exposes port 3000 externally.
Go to the ngrok status page and make a note of the URL.
Create a new integration in Commerce Manager by doing the following:
Log into the Commerce Manager.
Go to Settings > Integrations.
Click New Integration.
In the Integration details section, enter a name and description for your integration.
We recommend to prefix the name with
DEVELOPMENTfor easier referencing.
In the Configuration section, enter the ngrok URL and a secret key.
In the Observes section, select Created option in Order.