WooCommerce Webhooks using Otto

Otto from Proof+Geist can be used to receive webhooks from WooCommerce and have new WooCommerce Orders pushed automatically to your fmEcommerce Link (WooCommerce Edition) file. You will need to make a few small modifications to your copy of fmEcommerce Link (WooCommerce Edition) - we've added support for Otto webhooks in v2.0.8 of fmEcommerce Link (WooCommerce Edition). 

If you're using an earlier version of fmEcommerce Link the required changes are outlined on the Otto website here and include creating a new layout, 2 new fields and 1 new script. You can copy/paste the OttoReceiver script from the v2.0.8 file to your file. Your new OttoReceiver layout (based on the Orders table) should look like this:

In the following example we will show you how to create an Otto webhook to receive new order notifications from WooCommerce (similar to the webhookNewOrder.php file). You can also adapt this for other supported webhooks such as order updates and new customer/customer updates.

Once you've made the necessary changes you need to create a new Otto Data API key by following the instructions here. We recommend using the supplied OttoDeveloperAPI.fmp12 FileMaker file to create the key which only takes a few minutes. When creating the Data API Key you can use the same FileMaker account that the webhookSignedEnvelope.php file uses here as it has the required access privileges for receiving incoming webhooks via the Data API:

Once you've generated the Data API Key for the fmEcommerce Link file you can make a note of the URL for the WooCommerce webhook. We are using the query parameter option to handle the authentication. The webhook URL should look something like this:

https://otto-server-url:3030/receiver/fmEcommerce Link (WooCommerce Edition).fmp12/woocommerce?apiKey=<your-api-key> 

You now need to test the webhook trigger by creating a webhook on the WooCommerce site for a new order. You can follow the WooCommerce instructions on how to setup Webhooks – make sure you select the appropriate option for the Topic (e.g. for the New Order webhook select Order Created for the Topic) and enter the Otto 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 you will need to enter a new test order on your WooCommerce store to trigger the webhook. N.B. in our experience it can sometimes take a few minutes for WooCommerce to send the webhook request to Otto so please make sure you wait a few minutes. You should see the new order created and the data for the order populated into the appropriate fields - the OttoReceiver layout should look like this for the newly created record:

Still need help? Contact Us Contact Us