Webhooks are a useful tool for apps that want to execute code after a specific event happens, for example, if you creates a sales order in odoo. Instead of telling your app to make an API call every X number of minutes to check if a specific event has occurred, you can register webhooks, which send an HTTP request from odoo telling your app that the event has occurred. This uses many less API requests overall, allowing you to build more robust apps, and update your app instantly after a webhook is received. Webhook is mainly used by online application platform. The idea is that it's easy for vendors to integrate.


How it Works

  • Attach the small code snippet to a web application/site to ‘listen’
  • Trigger event occurs
  • Webhook sees the event and catches the specified data
  • Forwards the information back to your app
  • Data is aggregated and consumed

Push: receiving data in real time

Push is the simplest of reasons to use WebHooks. As was just stated above, no more polling every couple of minutes to find out if there is new information. Just register a WebHook and receive the data at your doorstep as soon as it exists. It's less work, less hassle, and you'll probably even receive it sooner than if you were asking for it every couple of minutes.


Pipes: receiving data and passing it on

A Pipe happens when your WebHook not only receives real-time data, but goes on to do something new and meaningful with it, triggering actions unrelated to the original event.

For example, you create a script, register its URL at a photo site, and have it email you when your mother posts a new photo. Or make a script that creates a Twitter message, and have it triggered by a WebHook whenever you add a new product on your commerce website.


Plugins: processing data and giving something in return

This is where the entire web becomes a programming platform. You can use this form of WebHooks to allow others to extend your application. Facebook's Application Platform uses WebHooks in this way, and so does Google Wave's robot integration. The general idea is that a web application sending out data via WebHooks will also use the response to modify its own data.

At Facebook, when you access an app, Facebook sends a WebHook out to your application saying "Hey, someone's accessing your application, what do I do?!" The application responds with, "Show the user this page..." Facebook does so, and the pattern continues in the same manner as you continue to use the application. At Google Wave, when you do something in a wave, any robot you've added as a participant is notified via a WebHook, and the robot has the ability to modify the wave in its http response. Implement WebHooks in this way in your application if you want to allow others to truly extend and enhance the abilities of your application.

This is where the entire web becomes a programming platform. You can use this form of WebHooks to allow others to extend your application. Facebook's Application Platform uses WebHooks in this way, and so does Google Wave's robot integration. The general idea is that a web application sending out data via WebHooks will also use the response to modify its own data.

Authorizing a webhook request Odoo Webhooks authorization relies on OAuth 2.0 protocol. Need following information for authorization:

  • Requested by which user?
  • A request put in 15 minutes window will be considered valid
  • To prevent hacking - Unique token (Nonce) generated has not to be repeated in 15 minutes window.
  • Any application requires request-headers or querystring with enough information to authorize webhook requests in Odoo.

Who is providing webhooks:

  • PayPal
  • Shopify
  • WooCommerce
  • SEOshop
  • GitHub
  • MailChimp
  • And many others..
  • Now Odoo as well
 

Contact Synconics for ERP Implementation, Digital Transformation, Counter Supervision of ERP and permanent partner for ERP Support.


Want to speak to us about Odoo ERP?
Drop us a mail on: contact@synconics.com
Skype: synconics.technologies

Let's talk

call +91 942-686-4274