Shopify Webhooks Using Claris Connect
You can use Claris Connect to create a flow to handle incoming updates from Shopify such as new orders or customer updates. This is a much simpler process than using the supplied PHP files for the FileMaker Data API as you don't need to worry about hosting the php files and dealing with web servers and PHP configuration changes etc. You can setup a new Claris Connect Flow in a few minutes which can receive updates from Shopify and create new Order records or update existing customer records.
For information on the supported versions of FileMaker Server/FileMaker Cloud and other minimum requirements please see our Claris Connect Webhooks FAQ article.
In the following example we will show you how to create a Claris Connect flow to receive new order notifications from Shopify (similar to the webhookNewOrder.php file). You can also adapt this for other supported webhooks such as order updates and new customer/customer updates.
To setup a new Claris Connect Flow to have new Shopify Orders pushed automatically to your fmEcommerce Link (Shopify Edition) file:
1. login to Claris Connect and create a new Project and give the Project a Name (e.g. New Shopify Orders)
2. click the Webhooks button on the left to create a new Webhook that we can use for receiving incoming orders
Click the Create a webhook button to create a new Webhook for your Project
2. you will then be prompted to enter a webhook name that will appear in the URL. Enter your preferred name (e.g. newShopifyOrder) and click the Create button:
A new webhook will be created showing the URL for this webhook:
Make a note of the URL and copy this somewhere else as you will need to enter this into your Shopify store Webhooks settings.
3. now that the webhook has been created click the Flows button on the left to create a new flow for this webhook. Search for HTTP in the list of triggers:
Click on the HTTP app that appears which takes you to the Incoming HTTP Request screen. You will then be prompted to choose the Webhook from the drop down list. You should see the webhook you created earlier:
You now need to test the webhook trigger by creating a Shopify webhook on your Shopify store for a new order. fmEcommerce Link (Shopify Edition) supports creating webhooks from within the fmEcommerce Link file as well as those created on the Shopify website. We recommend creating the webhook on the Shopify website as you can send a test notification without having to enter a new test order. You can find instructions for creating a webhook on the Shopify admin page for your store here. Make sure you select the appropriate option for the Event (e.g. for the New Order webhook select Order creation) and enter the Claris Connect Webhook URL in the Delivery URL field. Once you have created and saved the Webhook it should look something like this:
After you have saved your webhook scroll to the right and click the Send test notification button to send a sample webhook to your Claris Connect webhook URL:
Shopify will send a request to the Claris Connect Webhook URL to confirm that it is responding correctly. Once Claris Connect has received the webhook request from Shopify the Save Trigger button will become active - click the Save Trigger button to continue:
5. you now need to add another action to the Claris Connect Flow which will create a new record in the Orders table in the fmEcommerce Link (Shopify Edition) file and populate the relevant fields with data from the incoming order. Click the + button and select Action to add a new Action:
In the list of apps search for 'FileMaker' and select the appropriate option for where your copy of fmEcommerce Link (Shopify Edition) is hosted:
After selecting the appropriate Claris FileMaker option choose the Create record option and click Continue:
6. you will then be prompted to authenticate with your Claris FileMaker server (the process is slightly different for each option):
You can use the same FileMaker account that the PHP files use here as they have the required access privileges for receiving incoming messages via the Data API. After you have successfully authenticates click the Continue button:
7. you then need to choose the FileMaker layout to use - select the WebOrders layout which is the same layout the PHP files use and has the necessary fields:
To map the Shopify Order data from the incoming webhook to the matching FileMaker field click the blue icon to the right of the following fields and select the option from the list (you should see the data from your test Shopify webhook notification):
You only need to map the following fields:
We are replicating the same behaviour as the webhookNewOrder.php file - a new record is created in the Orders table, the _kf_ShopifyID field is populated with the Shopify ID and the WebhookOrderJSON field is populated with the complete body of the webhook JSON data.
Click the Save button - your Flow should now show the following 2 actions:
8. We now need to add another Action to perform a FileMaker script after the new Order record has been created by the webhook. Click the + button to the right of the Create record action and select Action:
We are going to select the same FileMaker app that we used for the previous action. Select your FileMaker Server that was previously created which should appear under Your Apps and click Continue:
Select the Execute script option and click Continue:
Then click the Continue button at the next screen:
Select the WebOrders layout again and the Process Webhooks Order script (same as the PHP file version). For the Script parameter we are going to pass in the Shopify Order ID which you can select from the webhook payload as you previously did by clicking the blue icon to the right of the Script parameter field:
Click the Save button - your Flow should now show the following 3 actions:
You can now toggle the Disabled option to Enabled - you will receive the following prompt:
Click Save to make your Flow active. You can now test this is working successfully by entering another test order on your Shopify store and you should see the new order created and the data for the order populated into the appropriate fields.