Betsy Bot Documentation
  • Betsy Bot Discord Bot
    • Betsy Premium Subscriptions
  • Global Commands
    • /user
    • /ticket
    • /payment
    • /giveaway
    • /channel
    • /ai
    • /review
    • /github
    • /key-value
  • Features
    • Settings
      • Auto Roles
      • Setting up your custom bot
      • Global command management
      • Update configuration owner
    • Support Panels (Tickets)
      • Create Support Panel
      • Edit Support Panel
      • Delete a Support Panel
      • Copy a Support Panel
      • Custom Implementations
    • Giveaways
      • Create giveaways
      • Edit giveaways
      • Delete giveaways
    • Polls
      • Create a poll
      • Edit a poll
      • Delete poll
    • Thread Channels
      • Create Thread Channels
      • Edit Threads Channel
      • Delete Thread Channels
      • Disable a Thread Channel
    • Send Message / Announcement
      • Create Message/Announcement
    • Tracked messages
      • Create Tracked Messages
      • Edit Tracked Messages
      • Copy Tracked Messages
      • Delete Tracked Messages
    • Sticky Messages
    • Welcome Messages
      • Create Welcome Messages
      • Edit Welcome Messages
      • Delete Welcome Messages
    • Auto Responders
      • Create Auto Responders
      • Edit Auto Responders
      • Delete Auto Responders
    • Custom commands
      • Create custom commands
      • Edit custom commands
      • Delete custom commands
    • Invite Tracker
    • Payments
    • Action Logs
    • Invite Link Blocker
    • Role Selection
    • Channel Cleaners
      • Create channel cleaners
      • Delete configuration of a cleaning channel
      • Update channel cleaning
    • User Verification
    • Reviews
    • Twitch Event Subscriptions
    • Channel Backups
  • Configurable Commands
    • Response Commands
    • Data Commands
      • Forms
      • REST Commands
  • Extras
    • Server Resources
      • Message Templates
      • Forms
      • Key Value Storage
    • Message Templating Engine
      • Message FAQs
    • Custom ID Actions
    • Betsy REST API
      • Webhooks
    • Betsy Webhook Messages
    • Github Integration
Powered by GitBook
On this page
  • Configuration
  • Understanding the Dot Notation Property Mapping

Was this helpful?

  1. Configurable Commands
  2. Data Commands

REST Commands

REST Data Commands can be used to interface with external APIs in a variety of ways.

PreviousFormsNextServer Resources

Last updated 1 year ago

Was this helpful?

Configuration

Specify the API Url to set what REST endpoint will be called when executing the command. As of this moment you can choose from POST / PUT / PATCH / DELETE / GET

URL Configuration

The URL used also accepts dynamic URL that are driven by the parameter name using the same syntax as the Message Template Engine. Anything wrapped in ${} will be replaced with the matching value for the given parameter name.

In the event you are using a parameter for a dynamic URL the response, the parameter that matches parameter mapping will go unused. Anything can be put into this.

Header Configuration

The header configurable allows you to set custom headers that may be required for the REST endpoint to work as expected

Add a new header by clicking the "Add Header" button. You can then enter the name and value for that header

Any set headers will overwrite default headers.

Command Parameters

Create up to 25 parameters of different types. This determines how they are formatted when building the JSON to send to the specified URL

Configuration Option
Explanation

Name

This is the name of the parameter in the discord command. This is not used in the data mapping

Description

This is the description of the parameter for the discord command. This is not used in the data mapping

Type

View below for information on types

Mapping

There are various types that have different JSON mapping behavior.

  • String

    • A plain text parameter that allows any plain text characters. There is little to no validation around this parameter

  • Number

    • Parameter must be a numeric value. Allows decimals. Validation is handled by Discord. Will be sent as a number in the JSON object

  • Integer

    • Parameter must be a whole number. Decimals are not allowed. Validation is handled by Discord. Will be sent as a number in the JSON object

  • Boolean

    • Parameter must be true or false. Options are pre-populated by Discord in the parameter for quickly being able to select. Validation is handled by Discord. Will be sent as a boolean in the JSON object.

Default Data

Default data can be used to add any additional information that is not captured in a parameter. This allows you to have static information that may be required for every request to that endpoint.

Configuration Option
Explanation

Name

This is just used for you to better know what these are used for. These are for you only.

Type

View below for information on types

Mapping

Value

The value to be inserted into the data.

Understanding the Dot Notation Property Mapping

For this example I am going to assume you have read the above and understand how to make properties and then show you an example and how it would behave for the data mapping.

Let's take the following parameters as an example

Name
Value
Type
Mapping

param1

something

string

someObject.param1

param2

1.50

number

param2

param3

true

boolean

someObject.boolean

param4

5

integer

someObject.anotherObject.param4

Using the above parameters you will have a generation JSON that looks like the following:

{
    "someObject": {
        "param1": "something",
        "boolean": true,
        "anotherObject": {
            "param4": 5
        }
    },
    "param2": 1.50
}

Note that the name of the parameter does not matter. See how param3's mapping has someObject.boolean and the name "param3" is not present anywhere.

In the example below I am target the public Star Wars API to allow fetching of any available endpoints and their matching ID parameters.

The dot notation form to map the parameter values to the generation JSON data. Refer to

The dot notation form to map the parameter values to the generation JSON data. Refer to

https://swapi.py4e.com/
Understanding the Dot Notation Property Mapping
Understanding the Dot Notation Property Mapping