Webhooks

Knowledgebase

What are webhooks?

Webhooks, also known as web callbacks or HTTP endpoints, are a way for an application to provide another system with real-time information. The application with the info pushes it out in response to an event. Webhooks can be used in ProductLift applications so that when something happens on the service, ProductLift will send data about that event back to your server.

What is a webhook endpoint?

A webhook endpoint is an HTTP or HTTPS endpoint on your server with a URL. You can provide this to another service that wants to send you data and then receive the payload at that endpoint whenever it changes. Webhook endpoints are often used for sending push notifications, but they have much broader applications, especially when you're working in the API world. If you need to integrate something without using an API, using webhook endpoints could help make everything work together nicely.

Making a webhook in ProductLift

Follow these steps to let ProductLift send webhooks to your endpoint:

  1. Go to your portal, and then in the menu go to 

    Settings > API & Webhooks

    .
  2. Click 

    Add webhook

  3. Enter your webhook endpoint
  4. Click 

    Add

ProductLift can send the data to multiple endpoints.

Webhook events in ProductLift

ProductLift sends the following events to your webhook endpoint(s):

  • post.created - user added a new post
  • post.deleted - post that is deleted
  • vote.created - user liked a post
  • vote.deleted - user unliked a post
  • comment.created - user added a comment
  • comment.deleted - user removed comment

You can test the output of a webook by adding a webhook tester.

Data structure of the webhooks

Webhooks from ProductLift follow this structure:

  • id - a unique identifier
  • creation_time - the time of the event
  • event - type of event (see webhook events above)
  • data - related data models such as the post is displayed on the tab based on its status." data-toggle="tooltip">post, user, and portal

Securing your webhooks (recommend)

Use webhook signatures to verify that ProductLift generated a webhook request and that it didn’t come from a server acting like ProductLift.
You can find your portal's secret at the top of the page of Settings > API & Webhooks. This secret is used to sign each webhook request.

image-20240306234750839

Quick Example:

The following webhook is sent by ProductLift when a new vote has been received.
You can see the vote, the post is displayed on the tab based on its status." data-toggle="tooltip">post, and the portal data.

{
  "id": "vg3EGg2wcHgd8nMl",
  "creation_time": "2022-06-01T18:17:37Z",
  "event": "vote.created",
  "data": {
    "vote": {
      "id": 500,
      "created_at": "2022-06-01T18:17:37.808782Z",
      "voter": {
        "id": 48,
        "name": "Rubenb",
        "email": "ruben@abc.nl",
        "role": "admin",
        "counter_votes": 2,
        "counter_comments": 18,
        "counter_posts": 12,
        "counter_comment_votes": 0
      }
    },
    "post": {
      "id": 99,
      "title": "This is a great idea",
      "description": "Wow. This is the best idea I have ever seen!",
      "author": {
        "id": 48,
        "name": "Rubenb",
        "email": "ruben@abc.nl",
        "role": "admin",
        "counter_votes": 2,
        "counter_comments": 18,
        "counter_posts": 12,
        "counter_comment_votes": 0
      }
    },
    "portal": {
      "id": 4,
      "title": "Test Portal"
    }
  }
}
Ruben

7 months ago