FAQs and Guides » Weeby API

FAQs and Guides

Get the answers to some of the most frequently asked questions about Weeby API and learn how to use our API and Webhooks!

Common Questions

A Rest API Service that lets you generate images, create image effects, fetch GIFs and so much more.

No, the bot can only be used on the Discord Server. The bot will only be used for handling applications, viewing documentation, and everything else about Weeby API.

This means you need to check that your token is correct and supplying the correct Authorization Headers. See the Getting Started page to find out how to authenticate to our API.

This happens when the API requires an input from the user. This input is used to assign values to specified parameters, so make sure to supply the correct values as explained in the error response.

Depending on the endpoint used, it will always return either JSON or a Image Buffer.

You can revoke your token by visiting the Dashboard Token Page and clicking the "Reset Token" button, or by running the /token reset command in the Discord Server.

We recommend that when you suggest for a new Weeby API feature, that you follow a simple etiquette that ensures the team understands what you would like to see added in a future update.

  • Keep the suggestions original and simple, if there are existing features found on other APIs, we may not add them.
  • When we mean simple, features should not be too challenging to code. Like if we were to make a image generator that involves canvas rotations, it makes coding a nightmare.
  • Do not suggest GIF endpoints. These are only exclusive for the developer to decide and we cannot guarantee if each GIF is considered NSFW. This is where we have to come in and manually review the images.
  • No Search/Lookup endpoint suggestions. As these have their own APIs, use those instead as if we were to add our own, you will have to request the endpoint through Weeby API, then Weeby API has to request another API to get that relevant information.
  • No NSFW or otherwise offensive suggestions.

We have not enforced any rate-limits on the API but we expect you to cache the responses especially if you have a bot that has a lot of servers and relies on Weeby API. It's recommended that you implement caching to save the API's resources from being used up (i.e bandwidth, hosting).

Absolutely! safety of users that rely on Weeby API is the top priority. The service has Endpoints and GIFs that are appropriate for all ages (PG-13) and with the GIFs/Images, they're manually reviewed for any NSFW, Lolicon or inappropriate content and/or references. If you come across something inappropriate, join the Discord Server and report it to the developers.

If your question doesn't get answered here, join our Discord Server or email us at [email protected]". The developers are always available to help with your problem.



API Guide

Now that you've been accepted and received the token from the Weeby API bot, you want to know how to use the API and take the opportunity to test the token with the curl command.
Type this in your console:

Shell $ curl -X GET 'https://weebyapi.xyz/gif/zerotwo' -H 'Authorization: Bearer YOUR_TOKEN'
If successful, it should return a JSON Object (shown below) of the GIF and that means, you should be able to use our API in your creation!
JSON
{
    "status": 200,
    "url": "https://cdn.weebyapi.xyz/img/gif/zerotwo/14.gif",
    "path": "/img/gif/zerotwo/14.gif",
    "type": "zerotwo",
    "number": 14,
    "totalGifs": 22
}
For the ease of use, Weeby API supports two types of authentication:
  • Authorization Header Bearer - Secure
  • Query Strings ?token= - Insecure
Just for the safety of all developers, we recommend following our examples on the website as it uses the Authorization Header for authenticating our API endpoints. If you know what you are doing with Query Strings, good for you!

Our API returns JSON responses for all endpoints. You can use the JSON response to parse the data and use it in your application.

While we do not have any official API Wrappers, there are some community-made wrappers available for the Weeby API. We cannot guarantee their safety and security, so please use them at your own risk.

Note: If you have used weeby-js in the past, it is deprecated and no longer supported. We still will keep it on NPM for those who still use it and the website as well.



Webhooks Guide

Before you can start working with Webhooks, you will need to go and visit the Weeby API Dashboard and generate a Webhook Authorization Token, or using the /token generate command with the Weeby API bot.


Events

If you would like to receive updates from the API without making requests. You can setup our event webhook system to get events whenever a user votes your bot on Top.gg.

To verify requests are coming from Weeby API, we will provide the Authorization header with your Webhook Authorization token. It's recommended to verify every request to ensure it is coming from Weeby API.

Events sent by Weeby API must be acknowledged with a 200 response in order to be considered successful.


Setting up

First, make sure that you have a web server which is public and accessible by any IP Address. You will then need to visit the Event Webhook page on the dashboard. There you will find the configurable settings for event webhooks.

Webhook page

The options are as listed in the section:

Fill in the details, and then click the Save button. Now events will be sent to that URL.

Bot Vote Event Object

JSON
    {
        event: "bot-vote",
        userID: String,
        botID: String,
        voteDate: Number,
        voteExpiry: Number,
        isWeekend: Boolean,
}

Top.gg Voting

With Weeby API's Top.gg Webhook Integration, you will easily integrate to have webhook messages sent to a Discord channel whenever a user votes for your bot on Top.gg.

TIP

This setup focuses on setting up voting webhooks for bots, this is the same for servers except you need to provide the Server ID.

To ensure the best experience, make sure that you follow this guide, the fields to have webhooks setup correctly to avoid issues such as not providing the token, or Message Spamming.


DANGER

Do not use the Top.gg Webhook System for other bot list websites. It will not work because of the payload data, which leads to the webhook system breaking.



Setting up

Go to the Top.gg Webhook page to start configuring the webhook settings. You will find the following details which you should not show anybody:

Top.gg Webhook

Now, while we are on this section. Fill in the following fields:

Webhook fields

Discord Webhook URL

This is the Webhook URL that you can obtain by right-clicking any Channel > Edit Channel > Integrations > Webhooks. You will then need to create a Webhook, name it and provide a nice avatar for it.

Discord Webhook

Then, copy the Webhook URL and paste it in the Discord Webhook URL field. Do not show this to anybody because this contains the token and channel ID to make sending the content possible.



Embed Code

This is what the message will look like when it gets sent. Neat right? Well, to guarantee and ensure that the embeds are to be sent correctly without problems, use this Embed Builder tool that is specialized for designing Discord Webhook messages.

Webhook Builder

When you're finished designing your embed, click on JSON Data Editor and copy the JSON code. Paste it into the Embed Code field.

Back on the dashboard, click Save and the page will reload with the new changes (shown on the fields).



Bot Webhook page (Top.gg)

The next step involved is going to your bot's webhook page on Top.gg, visit this link:

https://top.gg/bot/:BOTID/webhooks

Replace :BOTID with your Bot's ID.


When you are on this page, scroll down to Webhooks. Here you will need to fill in two fields that you have viewed on the dashboard earlier:

Top.gg Webhook

Click Save and you're all set!


Testing

You are now ready to test webhooks! To ensure the webhooks are working click on the Send Test button.

Send Test

You're all done with setting up! To see that your webhook message sent, go to the channel you created the webhook in and you'll see the webhook message.

Webhook Message

Embed Variables

You may use these embed variables to display certain data in the message. Variables will need to use curly braces {}. To guarantee for mentions to render properly, make sure both the user and bot is in the server! Also, dates are returned as a Unix Timestamp so that it can work with Discord message timestamps.

User
Bot
Misc.