Sending Information With Whop

Easily and quickly give users access to information through the Provider Marketplace

📝 Getting Started

Informational Webhooks are one of the types of apps Whop supports on the App Store. These webhooks can be plain text messages, or more elaborate embeds, which help you convey a message or spread information. Integrating your project with Whop has never been easier.

To start, you'll need some information to send. For the case of these docs, we'll be using the example of an NFT sale tracker. You might have a web app or script generating the information, or you might be sending info yourself, but the general process is the same after you have your info.

 

🛠 Making your App

So you have some information ready to send, now what?

  • Create an app on the Whop App Store: Once you're logged into your Whop account, head over to the Apps page and click "Build An App" in the top right. Fill in the requested information, and click "Create App"
20002000
  • Add API Keys: Once you've made your app, you'll need to get your bearer token (which will be used to authorize all of the requests you send to Whop).
  1. Open your app's page, and then click "Edit app" in the top right corner.
  2. Scroll down to the bottom of that page, and you'll see an example request.
  3. The long string inside of quotes is your token.
  • Sending Your First Webhook: You have your information ready, and you have your bearer token. Now, all you need to do is send the information to Whop! Your headers need to contain the key value pair of "authorization" and your bearer token, and your data needs to be sent in JSON format in the body of the request. Here's an example of this in TypeScript:
export const sendToWhop = async (info: any) => {
  var options = {
    method: 'POST',
    url: `https://data.whop.com/provider`,
    body: info,
    headers: {
      'content-type': 'application/json',
      authorization: BEARER_TOKEN,
    },
  };

  request(options, function (error: any, response: any, body: any) {
    if (error || body == undefined) throw Error(error);
    try {
      body = JSON.parse(body);
      return body;
    } catch (error: any) {
      throw Error(error);
    }
  });
};

 

📲 What Data Should I Send?

Whenever you send data to Whop (seen above as the variable info), you need to have it in the following format:

{ data: someRandomObject, embed: someDiscordEmbedObject }

Where someRandomObject and someDiscordEmbedObject are two objects of any schema and any name. Going off of the NFT sale tracker example, you may have someRandomObject sent like this:

let saleInfo = {
  collection_name: 'Bored Ape Yacht Club',
  price_eth: 93.8,
  price_usd: 148913.82,
  marketplace: 'Opensea',
  contract_address: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d',
  sale_type: 'Sale',
};

The value of the data key is what will allow users to filter your information if need be. NFT sale trackers can send thousands of messages an hour, so you may want users to be able to follow certain collections. In that case, they would just filter the object (saleInfo) by the contract_address field of your data.

This can be expanded to just about any kind of use case, this example is just to show you one way to use the Informational Webhooks. You can filter by any field of your data as long you specify in the App Variables setting of your app.

Your someDiscordEmbedObject is the embed JSON object that will appear in your users' channels. In our case, the object might look like:

let discordSale = {
  "content": null,
  "embeds": [
    {
      "title": "New sale on Opensea",
      "description": "**BoredApeYachtClub #7116** has been sold!",
      "fields": [
        { "name": "ETH Price", "value": "Ξ93.8000", "inline": true },
        { "name": "Etherscan Info", "value": "[Etherscan Tx](https://etherscan.io/tx/0x2d659ca7ca7ad9b7160c4edde95a6097d93d3eded4575575ea9f9d40870ee417)\n[Buyer Etherscan](https://etherscan.io/address/0x7e99611cf208cb097497a59b3fb7cb4dfd115ea9)\n[Seller Etherscan](https://etherscan.io/address/0x3071a71194c5b128c6e96bfb55b35c1abd82e363)" }
      ],
      "image": { "url": "https://images-ext-2.discordapp.net/external/t6_FnEYjecmNTavDIlidtj_62cwmQFyVP4y056yZiPg/https/images.icytools.workers.dev/xl/collections/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/tokens/30b22cc7be97ee48126dd1b6fd9647fe" }
    }
  ],
  "username": "Whop NFT Sales",
  "avatar_url": "https://cdn.discordapp.com/attachments/981688088394887219/994388298996924436/unknown.png",
  "attachments": []
}

📘

Discord allows you to send specially formatted messages called embeds. These embeds have an infinite number of customization options, so using a tool like Discohook can help you easily make (and save) templates to use later.

With all of this data completed, it's time to send your request.

26082608

📚 Recap

Whop's Informational Webhooks are an easy way to monetize the sending of information to users. To set this up, all you need to do is:

  1. Make an app on the Whop Dashboard
  2. Make an embed, manually or programmatically
  3. Send your embed using a bearer token
  4. Watch as your users get their info, and you get your $$$

Whop Informational Webhooks - so easy a 10 year old could do it.

If you want to play around with Informational Webhooks, here's a Github repository containing a very simple project you can use to base yours around!

 

🗺 Where Does This Data Go?

When you send your info to Whop, you may be wondering how users can specify where it all goes. This is configurable for each company using your app, and Whop handles filtering and sending this info to your users. If you want to see your info in your own personal channel, you can navigate to the app's page on the dashboard, and subscribe one of your personal channels to the app.

 

👑 Making Your Embed Pretty

Discohook gives you a powerful GUI to create embeds exactly how you want. For the NFT sale tracker, this is what our preview looked like:

Once you understand how Discord handles embeds, you'll be able to make them programmatically (if your use case warrants it). If you want to play around with this side of embeds, try editing the JSON data in Discohook and watch how it effects the preview.

26642664

Did this page help you?