BotGhost Documentation
Support ServerYouTubeMarketplaceBotGhost PremiumSign in
  • Welcome to BotGhost
  • Guidelines & Privacy
  • Changelogs 2025
    • Changelogs 2024
    • Changelogs 2023
  • BotPanel Documentation
  • Getting Started
    • Create Your First Bot
      • Create Your Second Bot
    • Invite Your Bot
    • Standard Practices
      • Advanced Practices
    • Mobile Application (PWA)
  • Support
    • BotGhost Support
    • Frequently Asked Questions
  • Premium & Priority Hosting
    • Priority Hosting
    • Our Premium Features
    • Plans & Payment Methods
    • Manage Your Subscription
    • Upgrade Your Bot
    • Refund & Cancellation Policy
    • Beta Features
  • General Settings and Collaboration
    • Settings
    • Collab
    • Status
    • Active Developer Badge
    • Marketplace
  • Custom Commands & Events
    • Command & Event Builder
      • Sharing Commands and Events
      • Advanced Options
    • Actions
      • Message Actions
        • Send or Edit a Message
          • Button
          • Select Menu
        • Edit a Button or Select Menu
        • Send a Form
        • Delete a Message
        • Publish a Message
        • React to a Message
        • Pin a Message
      • Custom Variable Actions
        • Set Variable
        • Run Equation on Variable
        • Delete Variable
      • API Actions
        • Send an API Request
        • Execute an IFTTT Trigger
      • Loop Actions
        • Run a Loop
        • Stop a Loop
      • Voice Actions
        • Join a Voice Channel
        • Leave a Voice Channel
        • Voice Move a Member
        • Voice Kick a Member
        • Voice Mute or Unmute a Member
        • Voice Deafen or Undeafen a Member
      • Role Actions
        • Add Roles
        • Remove Roles
        • Create a role
        • Delete a role
        • Edit Role
      • Channel Actions
        • Create a channel
        • Edit a channel
        • Delete a channel
      • Thread and Forum Actions
        • Create a Thread
        • Edit a Thread
        • Delete a Thread
      • Server Actions
        • Kick a member
        • Ban a member
        • Timeout a member
        • Change a members nickname
        • Purge Messages
        • Create Server Invite
      • Other Actions
        • Wait before running another action
        • Manipulate some text
        • Send an error log message
        • Set a unique variable
        • Change the Bot's Status
        • Note
      • [LEGACY] Reply Actions
        • Plain Text Reply
        • Embed Reply
        • Random Reply
        • Send a message to a channel
        • Direct Message a User
        • Send a Message with attached buttons
          • Buttons
        • Send a message with a select menu
          • Menu Option
    • Conditions
      • Comparison Condition
      • Permission Condition
      • Chance Condition
      • Channel Condition
      • Role Condition
      • User Condition
      • Premium Check Condition
    • Options
      • Text Option
      • Number Option
      • User Option
      • Channel Option
      • Role Option
      • Choice Option
      • Attachment Option
    • Events
      • Timed Events
      • Webhooks
    • Data Storage
      • Collections
      • Objects
    • IFTTT
    • Variables
  • Server Management
    • Moderation
    • Discord Automod
    • Tickets
    • Welcomer
    • Verification
    • Statistic Channels
    • Modmail
    • Auto-React
    • Sticky Roles
    • Emoji Manager
    • Polls Filter
    • Automod
    • Logging
  • Messages
    • Timed Messages
    • Reaction Roles
    • Autoresponder
    • Embed Builder
    • Sticky Messages
    • Polls
    • Global Chat
    • Media Channels
  • AI
    • ChatGPT
    • Image Generation
  • Game Integrations
    • Roblox Verification
  • Social Integrations
    • YouTube
    • Twitch
  • Community Engagement
    • Leveling
    • Temp Voice Channels
    • Suggestions
    • Invite Tracker
    • Starboard
    • Question Of The Day
    • Giveaways
  • Fun Modules
    • Economy & Minigames
    • Birthdays
    • Counting
  • Utility
    • Translation
    • Weather
Powered by GitBook
On this page
  • Setting a request name
  • Building your request
  • Request URL
  • URL Params
  • HTTP Headers
  • Request Body
  • Options
  • Testing your request
  • API Action Variables

Was this helpful?

  1. Custom Commands & Events
  2. Actions
  3. API Actions

Send an API Request

Last updated 2 months ago

Was this helpful?

API Request actions allow you to run a http request when the action is executed. API Requests allow you to access and interact with the resources of another server outside of BotGhost. You can then use the returned information in your custom commands and events.

Setting a request name

API request actions use a custom variable that you can use to access the data returned by the request. You must first set a unique name that will be used as the variable for this request.

This name must be different from any other API request in the command or event.

Building your request

Once you have set the name for this action you will be able to start building your API request. Click the Request Builder to start building out your request.

This will open up the Request Builder modal which has six main components.

Request URL

URL Params

URL parameters or query strings are the way to structure additional information for the URL. These are generally added to the end of the Request URL after a ? symbol. You can add these by clicking the Add button on the URL Params menu.

These values will be added to the end of the URL and encoded correctly. You can use all variables in both the key and value.

HTTP Headers

Some APIs require you to pass headers along with the request to identify who the request is coming from or other information specific to that API. To add a header click on the HTTP Headers option in the menu and then click Add. You can use all variables in both the key and value.

This will create a new empty Header for your request. Enter the key and value for your header as defined by the APIs documentation. For example if the API requires Basic Authorization, your header might look like this:

Request Body

If you select a request type that requires some data to be sent along with it, you may attach this data through adding data to your Request Body. To add new data to your request's body, click the Request Body menu option and then click Add.

Similarly to headers, fill in the key and value of the data you wish to add to the request body. You can use all variables in both the key and value.

Options

The request builder has a set of options that change how your request is executed by the BotGhost backend.

Option
Explanation

Automatically exclude fields that are empty

This field will remove headers and body fields that are empty from the request.

Replace variables in the URL

Enabling this option will mean BotGhost will search for and replace variables in the URL of the request.

Replace variables in the URL Params

Enabling this option will mean BotGhost will search for and replace BotGhost variables in the URL Params.

Replace variables in the HTTP Headers

Enabling this option will mean BotGhost will search for and replace variables in the Headers of the request

Replace variables in Request Body

Enabling this option will mean BotGhost will search for and replace variables in the Request Body.

Testing your request

You are able to simulate and test how your API Request action will respond and test the potential value of a variable returned by the API. After you have filled out the above options, click the Test Request button to run a test request.

This will return the response, status and status text of the API request.

API Action Variables

You can access the data returned by using the name you set earlier and dot notation. Click on the value you want to automatically copy the variable required to return that data. For example using the above example with a name of calculator:

  • {calculator.response.age} - 64

  • {calculator.response.name} - Tom

  • {calculator.status} - 200

  • {calculator.statusText} - OK

You can click on any value in the response to get the variable required to return that data

You can test the value of any variable by putting it into the Test Variable input field.

If the Variable Result returns either undefined or [object Object] double check the variable you are trying to test. Only text and numbers can be returned. You can click on any value in the response to get the variable required to return that data.

These variables can then be used in any action or condition.

For the safety of your bot token you can use {TOKEN_SECRET} in the HTTP Header instead of copy & pasting your bot token when sending requests to the .

At the top of the window you must first enter the URL of the API you wish to send a HTTP request to. If you would like to find some APIs to play around with check out this . Paste the URL of the API endpoint in the URL field at the top. Next, select the request type of the URL you are trying to interact with. Consult the documentation for the API you are trying to interact with for this field, but in general a GET request retrieves data and a POST request sends data.

For the safety of your bot token you can use {TOKEN_SECRET} in the HTTP Header instead of copy & pasting your bot token when sending requests to the . The value of the "Authorization" key should look like this: Bot {TOKEN_SECRET}

Discord API
collection
Discord API
Setting a name for the API Request
The Request Builder