Welcome to the Shopify Order Creation Webhook Handler Template! This template is designed to help you seamlessly integrate Shopify webhooks into your application. With this template, you can easily set up a webhook listener that will receive notifications about new orders created in your Shopify store. This guide will walk you through the steps to get this template up and running on the Lazy platform.
To begin using this template, simply click on the "Start with this Template" button. This will initialize the template within the Lazy Builder interface, pre-populating the code for you.
Before you can test and use the webhook handler, you need to set up an environment secret that the code will use to verify the authenticity of the webhooks sent by Shopify.
SHOPIFY_WEBHOOK_SECRET
and paste the shared secret you copied from Shopify as the value.This secret will be used by the template to verify that incoming webhook requests are indeed from Shopify.
Once you have set up the environment secret, you can test the webhook handler by clicking the "Test" button. This will deploy the app and launch the Lazy CLI. No user input is required at this stage since the template does not prompt for it.
After pressing the "Test" button, Lazy will provide you with a dedicated server link to use the API. This link is where Shopify will send webhook notifications. Additionally, since the code uses FastAPI, you will also receive a link to the API documentation, which you can use to understand and interact with the API endpoints.
To integrate this webhook handler with Shopify:
Now, whenever an order is created in your Shopify store, Shopify will send a webhook to the URL you provided, and the webhook handler will process it and print the order details.
If you want to integrate this webhook handler into another service or frontend, you will need to use the server link provided by Lazy. For example, you might want to send the order details to an email service or log them in a database. Here's a sample request you might use to interact with the webhook handler:
POST [Your Lazy Server Link]/webhook
Headers:
Content-Type: application/json
X-Shopify-Hmac-SHA256: [Your HMAC SHA256 Header]
Body:
{
"current_subtotal_price": "100.00",
"currency": "USD",
"customer": {
"first_name": "John",
"last_name": "Doe"
}
}
And a sample response from the webhook handler might look like this:
{
"current_subtotal_price": "100.00",
"currency": "USD",
"customer": {
"first_name": "John",
"last_name": "Doe"
}
}
Remember to replace [Your Lazy Server Link] with the actual server link provided by Lazy and [Your HMAC SHA256 Header] with the HMAC header that Shopify sends with its webhooks.
By following these steps, you can quickly set up and integrate the Shopify Order Creation Webhook Handler with your Shopify store and any other services you use.
A python app for getting orders in a store using the Shopify API. The python FastAPI is used for making the API call. The app requires a SHOPIFY_ADMIN_API_TOKEN and "orders" scope permissions to authenticate requests. This app can be customized to get all orders by name, by order ID (order number), fulfilled orders only and so on.
A FastAPI application that retrieves all products from a Shopify store and returns them in JSON format. Requires the SHOPIFY_ADMIN_API_TOKEN environment secret. The app includes an endpoint at "/product_metafields" where users can provide a product ID and the Shopify store URL to retrieve the product's metafields. The only environment secret required is SHOPIFY_ADMIN_API_TOKEN, which must be set for the app to authenticate with the Shopify API.