Call API

Describes how to make your bot call an external API

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:

With this command, we'll let users ask questions to Chat GPT via our bot

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

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.

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.

Last updated

Was this helpful?