An example of a private Shopify app to auto-tagging customers based on order information.
- Node.js 5.x.x or newer
- ngrok
- Chrome
- Postman Extension
- Shopify store
- Create a private app in your Shopify store
- Git clone shopify-auto-tag-customers-example
- Run npm install
- Setup
.env
at the root of shopify-auto-tag-customers
API_KEY=xxxxxxxxxxxxxxxxxxx
PASSWORD=xxxxxxxxxxxxxxxxxxx
SHARED_SECRET=xxxxxxxxxxxxxxxxxxx
STORE=xxxxxxxxxxxxxxxxxxx
This step will need to be repeated each time you renew your ngrok tunnel.
If this is your first time running this, skip to step 4.
- Get your private app URL with your authentication.
- With Postman,
GET
all your webhooks. (https://apikey:password@hostname/admin/webhooks.json)
- Now, if one these webhooks is one that you have already created for this app, you will
PUT
the new address from ngrok.
{
"webhook": {
"id": 1111111111,
"address": "http://64ec84c4.ngrok.io/order_create"
}
}
- If you're subscribing to a new hook, we will
POST
with the new address from ngrok.
{
"webhook": {
"address": "http://64ec84c4.ngrok.io/order_create",
"topic": "orders/fulfilled",
"format": "json"
}
}
- Run
npm start
to get the local server up. (http://localhost:8000/) - Run
npm run tunnel
to get ngrok tunnelling your localhost to the outside world. - Setup a webhook on your Shopify store to point to your ngrok url.