What is Webhook

Source: Internet
Author: User
Tags webhook what is webhook

What is Webhook

Translation, original address: https://sendgrid.com/blog/webhook-vs-api-whats-difference/

I. Overview

Webhook is an API concept and is becoming more and more popular. The more things we can describe with events, the greater the scope of Webhook. Webhook is becoming more and more useful as a lightweight event-handling application.

To be exact, Webhoo is a Web callback or HTTP push API, a way to provide real-time information to apps or other applications. Webhook sends data as soon as the data is generated, i.e. you can receive data in real time. This is different from the typical API, which requires real-time polling to be fast enough. This is efficient both for production and for consumers, and the only drawback is the initial build-up difficulties.

Webhook is sometimes called a reverse API because he provides API rules that you need to design to use. Webhook will initiate an HTTP request to your app, typically a POST request, and the application is driven by the request.

Second, the use of Webhook

Consuming a webhook is to prepare a URL for Webhook for Webhook to send the request. These are usually done by the background page and/or API. This means that your app will set up a URL that can be accessed through the public network.

Most Webhook publish data in two data formats: JSON or XML, which needs to be explained. Another data format is application/x-www-form-urlencoded or Multipart/form-data. Both of these approaches are easy to parse, and most Web application architectures can do this part of the work.

Three, Webhook debugging

Debugging Webhook is sometimes complicated because the Webhook principle is asynchronous. You first have to unpack him, then wait, and then check to see if there's a response. It is dull and quite inefficient. Fortunately there are other ways to do it:

1, understand what Webhook can provide, using tools such as Requestbin to collect webhook requests;

2, use curl or postman to simulate the request;

3. Test your code with tools such as Ngrok;

4. Use the Runscope tool to view the entire process.

Iv. Safety of Webhook

Because Webhook sends the data to the URL that is exposed on the app, this gives the other person the opportunity to find the URL and send the wrong data. You can use technical means to prevent such a thing from happening. The simplest approach is to use HTTPS (TLS connection). In addition to using HTTPS, the following methods can be used to further improve security:

1, first increase token, this majority of Webhook are supported;

2, increase the certification;

3, data signature.

V. Important ISSUES

There are two things to keep in mind when you are a Webhook consumer:

1. Webhook no longer pays attention to the data after it has been sent to your app by request. This means that if there is a problem with your application, the data will be lost. Many webhook will handle the response and will retransmit the data if a program error occurs. If your app processes this request and still returns an error, your app will receive duplicate data.

2, Webhook will make a large number of requests, which will cause your application blocking. Make sure your app is able to handle these requests.

What is Webhook

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.