Discord Bot Studio
  • Discord Bot Studio Documentation v2.0
  • Setting Up DBS
    • Create and Setup Bot With DBS [video]
    • Getting Started with DBS [text]
    • Inviting a Discord Bot to Your Server
    • Enabling Intents
    • Finding Your Bot Token
    • Using the Bot Editor
  • Response Nodes (by type)
    • Message Category
      • Send Message
      • Send Image
      • Send Embed
      • Delete Message
      • Check if Message is in Channel
    • Reaction Category
      • Add Reaction Listener
    • Variable Category
      • Store Value in Variable
      • Edit Variable
      • Check Variable Value
      • Check if Variable Exists
      • Generate Random Number
      • Get Mentioned User
    • User Data Category
      • Set User Data
      • Get User Data
      • Edit User Data
      • Check User Data
    • User Action Category
      • Add Role to User
      • Remove Role from User
    • Control Category
      • Wait
      • Switch Case
      • Multiple Input
    • Interaction Category
      • Reply To Interaction With Message
      • Get Interaction Option
      • Delete Interaction Reply
    • External Category
      • Call API
  • Running/Hosting Your Bot
    • Hosting your bot 24/7
    • Running Bot Locally
    • Multiple Bots
  • Commands
    • Message Commands
    • Kick / Ban Command
    • Purge Command
    • Role reaction menu
    • XP System
    • Ticket System
    • Command Aliases
  • Events
    • Overview
    • Event Types
      • User Joins Server
      • Any Message
      • Bot Initialization
      • Channel Create
      • Channel Delete
      • Channel Update
  • Misc
    • How to use custom emojis
    • Buttons and Selects
      • Determining which button was clicked
    • Slash Commands
    • Tagging a role
    • Tagging a channel
  • Mods
    • Creating Mods
    • Installing Mods
  • Spreadsheets
    • Using Spreadsheet Data
Powered by GitBook
On this page
  • Overview
  • OpenAPI (GPT) example

Was this helpful?

  1. Response Nodes (by type)
  2. External Category

Call API

Describes how to make your bot call an external API

PreviousExternal CategoryNextHosting your bot 24/7

Last updated 1 day ago

Was this helpful?

Overview

Field
Description
Example

URL

The URL of the API endpoint you are calling

HTTP Method

The HTTP method verb

POST

Bearer token

The authentication token for your API call. Generally this is issued to you by the API service and is unique and private. Do not share this key with anyone.

sk-xyzabcdef

Request body

The request body for the API call. Must be properly formatted JSON. Leave this blank for GET requests.

{ "model": "gpt-4.1", "input": "Give me some whale facts please!" }

Response body variable name

This is the variable which you can use in other nodes to process the API response body.

gptResponse

OpenAPI (GPT) example

Example bot in action:

The following flow in BSD is used to get a prompt from the user and call Chat GPT (via OpenAI API)

We can reference gptResponse since we used that variable name in the API Call node.

That's it! Now when a user uses the !gpt command with our bot, their prompt will be sent to OpenAI and our bot will respond.

https://api.openai.com/v1/responses
With this command, we'll let users ask questions to Chat GPT via our bot
Flow layout, sends a message for API success with the response
The get input node is used to save the text after the !gpt command to a variable. We will pass this to the API as the prompt
The Call API node is used to send the user's prompt to the API endpoint to get a response from Open AI. Make sure to enter your actual bearer token here.
The send message node is used to send the GPT response in a message to the user.