Articles on: Integrations

How to use Webhooks for automation

This Webhooks feature can be found in Checkout Tab.

What is a webhook?



Put simply, as soon as something happens, the webhook immediately notifies other applications transferring the data about the event. Just like SMS that you get from your bank whenever there is some activity in your bank account.
So basically webhooks provide automatic real-time communication between apps and it's all done quickly and almost effortlessly.





What do I need webhooks for?



Using webhooks can be a great way to automate your business processes like order collection that results in saving lots of time and effort. All you need to do is integrate them with other tools you want to use.


How do I set the webhooks up?



To use webhooks you will need an intermediate automation service like Integromat, Zapier, etc.
There you need to add the tool you want to connect with your SpreadSimple website and then create your custom webhook URL. This URL should be pasted into Webhooks URL Field in your Checkout Tab on SpreadSimple.


Setting up the Webhook URL

After all the changes have been saved, make sure to have a test run to see that your service catches the webhook which means the connection is working. For that you just need to make a test order in your store.
If everything works fine the service will explore and gain the data structure which comes from your order request. That data is what will be used by the tool you want to integrate your SpreadSimple website with.

Use case:



Using Webhooks we build a CRM for our SpreadSimple store. We highly recommend you to watch this tutorial video to get the idea of how webhooks can be applied in an automation process.




The tech stuff



- Webhook makes a POST request to the specified URL
- The body is in JSON format
- Request body sample:

{
  "client": {
    "name": "Name",
    "phone": "123123123",
    "email": "testuser@mail.com",
    "message": ""
  },
  "cartItems": [
    {
     "sku": "abc-1", 
      "hash": 1196792671,
      "title": "Understanding IELTS: Writing",
      "image": "https://ccweb.imgix.net/https%3A%2F%2Fccweb.imgix.net%2Fhttps%253A%252F%252Fd3f1iyfxxz8i1e.cloudfront.net%252Fcourses%252Fcourse_image%252F1b5a1592dca2.jpg%3Fauto%3Dformat%26cs%3Dstrip%26fit%3D%26h%3D710%26ixlib%3Dphp-3.3.0%26w%3D400%26s%3D09eca4a01551572dd060a602e8f0dd3f?auto=format&ixlib=php-3.3.0&s=4e1c9826cb7166bb042e1d281c90e6fa",
      "quantity": 1,
      "optionsText": "",
      "priceFormatted": "$ 100",
      "price": 100,
      "rowData": [
        {
          "column": "Name",
          "value": "Understanding IELTS: Writing",
          "formattedValue": "Understanding IELTS: Writing"
        },
        {
          "column": "Topic",
          "value": "Test Prep, Grammar & Writing, Education & Teaching",
          "formattedValue": "Test Prep, Grammar & Writing, Education & Teaching"
        },
        {
          "column": "Author",
          "value": "British Council",
          "formattedValue": "British Council"
        },
        ...
      ]
    }
  ],
  "cartItemsText": "- Understanding IELTS: Writing | $ 100 × 1",
  "taxItemsText": "• Tax #1 × $ 10 \n• Tax #2 × $ 20",
  "shippingMethodText": "",
  "totalAmountFormatted": "$ 130",
  "totalAmount": 130,
  "orderId": "QO8BGCW",
  "formFields": {
    "name": "Name",
    "secondName": "Last Name",
    "phone": "111000999",
    "email": "testuser@mail.com",
    "address": "user address",
    "notes": "message text",
    "options": "Option 2"
  },
  "taxItems": [
    {
      "label": "Tax #1",
      "type": "multiplication",
      "value": 10
    },
    {
      "label": "Tax #2",
      "type": "addition",
      "value": 20
    }
  ],
  "shippingMethod": null,
  "paymentMethod": "cod"
}


Where sku, title, image and price are mapped values of Google Sheet rows.

Updated on: 06/03/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!