Managing Webhooks Using Zapier

Last modified January 7, 2019

This article applies to Contextual Commerce. (Looking for Classic Commerce documentation?)


About Zapier

Zapier is a third-party, user-friendly, online automation tool that makes it easier to connect two or more unrelated web applications.  Normally when two systems do not integrate directly, middleware must be coded and hosted to handle communication between the systems. Using Zapier, however, these communications can be processed and tasks can be dynamically triggered using only a limited amount of coding.

FastSpring sellers may choose to use Zapier to parse their webhook event posts and then pass that data to their own external solutions (e.g., CRM tools, accounting tools such as QuickBooks, etc.).

Important

Zapier is a separate company and is not related to FastSpring. Please bear the following in mind:

  • The information in this article is provided as a convenience only, and is subject to change without notice.
  • FastSpring makes no claim and offers no warranty or guarantee regarding the availability or up-time of any third-party service, including Zapier.
  • You are responsible for GDPR compliance and the security of all webhook event data that FastSpring may post, at your direction, to the endpoints specified in your FastSpring Store, including URLs of apps / services hosted by your company and / or by any third party (e.g. Zapier). For information from Zapier regarding their service's GDPR status, please see https://zapier.com/help/gdpr/.
  • Zapier offers various pricing plans, including a free plan. In order to use the service, you must have a Zapier account and you may need a paid plan. For more on Zapier's pricing, see https://zapier.com/help/plans-pricing/.



Setting Up a Zap to Parse a Webhook Event

Note

We recommend creating a separate "zap" for each FastSpring webhook event (e.g. order.completed) to which you want to subscribe, to avoid complications on the Zapier side.


  1. After creating your Zapier account, log on at https://zapier.com/app/login/.
  2. From the menu at the top of the page, click Make a Zap!.



  3. In the left-hand pane, click the Name Your zap field and enter a name for the zap. For example, you might give it a name matching the webhook event that you will be sending to this zap (e.g. order.completed).

    The left-hand pane of the zap creation dialog, including the Name your zap field

  4. In the central area of the page, under Choose a Trigger App, select Webhooks.

    The Choose a Trigger App dialog

  5. In the next dialog, click show less common options.

    Te Select Webhooks by Zapier Trigger

  6. Select Catch Raw Hook and then click Save + Continue.

    The Select Webhooks by Zapier Trigger with less common options shown

  7. In the Pick a Sample to Set Up your Zap dialog, click Copy to copy the Zapier URL to your clipboard.

    The Pick a Sample to Set Up Your Zap dialog

  8. Log on to your FastSpring Dashboard at https://dashboard.fastspring.com.
  9. On the Webhooks tab of the Integrations menu, click ADD WEBHOOK.

    The Integrations menu of the FastSpring Dashboard
    The Webhooks tab of the Integrations menu

  10. In the Title field of the Add Webhook dialog, enter a name for the new configuration, such as Zapier. You will be able to add multiple Zapier URLs to the same configuration as needed.
  11. In the Edit Server Webhook dialog, click the URL field and paste in the URL that you copied from your Zapier zap above. Then, select the check box next to the webhook event to which you want to subscribe, and click ADD.

    Reminder

    We recommend creating a separate "zap" for each FastSpring webhook event type (e.g. order.completed) to which you want to subscribe, to avoid complications on the Zapier side, so you should only select one event to be posted to the zap URL you are pasting in.


    The Edit Server Webhook dialog

  12. Back in your browser tab with the Zapier page, click OK, I did this in the still-open Pick a Sample to Set Up Your Zap dialog.

    The Pick a Sample to Set Up Your Zap dialog (again)

  13. In your FastSpring Store, run a test transaction or simulate an event (depending on the type of event to which you have subscribed above). For example, if you have subscribed to the order.completed event, you can place a new test order to fire that event to the new webhook configuration.

    Note

    You may need to wait a few minutes between creating a new webhook configuration and testing it (e.g. by placing a test order).
  14. Once Zapier has received the webhook event posting, the Pick a Sample to Set Up Your Zap dialog in your Zapier configuration will be updated to show that an event has been received, as in the following illustration. Click Continue.

    The updated Pick a Sample to Set Up Your Zap dialog, after Zapier has received a post

  15. In the Almost finished here! dialog, click the Your Zap currently lacks an Action step. Add one now! link.



  16. In the Choose an Action App dialog, select Code.

    The Choose an Action App dialog

  17. In the Select Code by Zapier Action dialog, select Run Python and then click Save + Continue.

    The Select Code by Zapier Action dialog

  18. Next, in the first field under Input Data, enter "data".  Then click the drop-down selector in the adjacent field and select Raw Body.

    Specifying input data

  19. In the Code field, first delete the example code and then replace it by copying and pasting in the following code, and then click Continue:

    import json
    webhook = json.loads(input_data['data'])
    output = []
    for event in webhook['events']:
        output.append(event)
    return output


    The Code field of the Set up Code by Zapier Run Python dialog

  20. In the Test Code by Zapier dialog, click Send Test to Code by Zapier.

    The Test Code by Zapier dialog

  21. The Test Code by Zapier dialog will be updated to let you know that the test was successful. Click Finish.

    The Test Code by Zapier dialog, reflecting a successful test

Congratulations, you have completed the initial setup process for the selected webhook event. You will now have access to all of the data in the event for any other steps you may add to your zap.



Next Steps

Once you have set up a zap to parse the incoming data posted from FastSpring for a certain event, the next step is to add one or more actions to your zap to do whatever you want with that data. Zapier offers actions for over 1,000 apps. For example, you might choose to use the Create Sales Receipt action with your QuickBooks Online app to conditionally send selected order data to QuickBooks. Since you presumably do not want data from future test orders to be posted to the service, you could add a condition to your zap so that the action would only occur when the Boolean data live field of an order.completed webhook event is true.

Support Note

If you need assistance setting up integrations from Zapier to third-party services such as QuickBooks, please contact Zapier's support team or the support contact for the third-party service to which you want to send data.

Once you have added actions to your zap to take advantage of the data it receives, remember to turn the zap on so it will be live and ready to execute those actions.

Turning on your zap