Discord Sales Bot

Hi All,

New to the community and coding, I’m trying to learn how to create my own sales bot that will pull information from OpenSea and display it in real time in my discord server. I have several different collections I’m trying to integrate as one. Would love the community if they have something they are already using or have put together.

Thank you in advance for your support.

Hi, @Natre, and welcome to the community! For sending to discord probably a webhook is easy, for getting data from opensea their API seem the best option.

PS: The code bellow can be a very good quickstart.

const webhookURL = "https://discordapp.com/api/webhooks/0000000000000000/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

function send(openseaData) {
  const request = new XMLHttpRequest();
  request.open("POST", webhookURL);

  request.setRequestHeader("Content-type", "application/json");

  const params = {
    username: "Opensea Bot",
    avatar_url: "https://opensea.io/static/images/logos/opensea.svg",
    content: {
      content: null,
      embeds: [
        {
          title: "Sales data",
          description: openseaData,
          color: 2130402,
          author: {
            name: "OpenSea",
            url: "https://opensea.io/",
            icon_url: "https://opensea.io/static/images/logos/opensea.svg",
          },
        },
      ],
      attachments: [],
    },
  };

  request.send(JSON.stringify(params));
}

fetch("yourOpenseaAPIURL")
  .then((e) => e.json())
  .then((e) => {
    // do what you want with the API result
    // and send the text to discord with the send(TEXT_GOES_HERE) command.
  });