Webhooks are a way for an application to provide real-time notifications to other systems when certain events occur. They allow you to build integrations that respond to specific events in a more efficient and scalable way than constantly polling an API for updates.

In this guide, we’ll explore how to set up and implement webhooks, including establishing a webhook endpoint, configuring your webhooks, and handling webhook notifications. We’ll also provide examples in both JavaScript and Python.


Webhooks can be utilized for various purposes, such as:

  • Automatically crediting a user’s account when they make a purchase.
  • Displaying a banner on your website when a user’s subscription is nearing expiration.
  • Adding new subscribers to a custom mailing list when they sign up for a subscription.

Creating a webhook

Access the Whop Business dashboard and navigate to the developer settings page. Here, you can configure your webhook endpoint URL, as well as manage all other aspects of the Whop API.

Upon adding the webhook, it will send a POST request to your API. If the API doesn’t return a 200 status code, the webhook will not be added.

Creating a webhook

Setup a server

To receive webhooks, you need a server capable of handling POST requests. You can achieve this using any programming language.

In the following example, we’re creating a server to receive data at the /went-valid endpoint. The server parses the relevant information from the JSON payload, allowing you to take actions like adding a user to your database or sending a custom email.

Hosting the server

You can host the server anywhere you want, but we recommend using a free service like ngrok or Hop.io. Both providers offer free tiers suitable for deploying an API.

After setting up and deploying your server, obtain the provided URL and add it to the webhook settings page. Remember to append /went-valid to the URL (or the appropriate endpoint name).

from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/went-valid', methods=['POST'])
def went_valid():
    data = request.json # Get the JSON payload

    membership_id = data['data']['id'] # This value is unique per membership
    user_id = payload['data']['user']['id'] # This is their Whop user ID
    user_email = payload['data']['user']['email']
    product_id = payload['data']['product']['id']
    plan_id = payload['data']['plan']['id']

    return jsonify(data)

if __name__ == '__main__':

Testing your API

Input the correct route into the modal and click the “Send test webhook” button. Our server will attempt to POST an example webhook event to the provided endpoint. If your application accepts the request and returns a 200 HTTP response code, you will see a green message indicating ”Test successful” Your endpoint will now start receiving events.

To view all webhook payloads, check the events section.

Test webhook