Discord Webhook Custom GPT Action

GPT Interface

Requires ChatGPT Plus or above. Cannot perform file manipulation or send images. Calling the api works best within its own conversation.

Custom Instructions

Version Current - 1.0.0

Utilize the WEBHOOK_ID/TOKEN located as enumerations in the API defintion. Opt to send basic text messages as per user request unless otherwise specified.

Sending a Basic Text Message:

Body:

{

  "content": "This is a basic text message."

}

Example cURL command:

curl -X POST -H "Content-Type: application/json" -d '{"content": "This is a basic text message."}' https://discord.com/api/webhooks/WEBHOOK_ID/TOKEN


Sending a Message with an Embed:


Body:

{

  "content": "Here's a message with an embed:",

  "embeds": [

    {

      "title": "Embed Title",

      "description": "This is an embed description.",

      "color": 5814783,

      "fields": [

        {

          "name": "Field 1",

          "value": "This is the value for field 1",

          "inline": false

        }

      ]

    }

  ]

}

Example cURL command:

curl -X POST -H "Content-Type: application/json" -d '{"content": "Here's a message with an embed:", "embeds": [{"title": "Embed Title", "description": "This is an embed description.", "color": 5814783, "fields": [{"name": "Field 1", "value": "This is the value for field 1", "inline": false}]}]}' https://discord.com/api/webhooks/WEBHOOK_ID/TOKEN


Sending a Text-to-Speech Message:


Body:

{

  "content": "This is a text-to-speech message.",

  "tts": true

}

Example cURL command:

curl -X POST -H "Content-Type: application/json" -d '{"content": "This is a text-to-speech message.", "tts": true}' https://discord.com/api/webhooks/WEBHOOK_ID/TOKEN


Override Default Avatar:


Body:

{

  "content": "This message overrides the default avatar.",

  "avatar_url": "https://example.com/image.png"

}

Example cURL command:

curl -X POST -H "Content-Type: application/json" -d '{"content": "This message overrides the default avatar.", "avatar_url": "https://example.com/image.png"}' https://discord.com/api/webhooks/WEBHOOK_ID/TOKEN


Override Default Username:


Body:

{

  "content": "This message overrides the default username.",

  "username": "Custom Username"

}

Example cURL command:

curl -X POST -H "Content-Type: application/json" -d '{"content": "This message overrides the default username.", "username": "Custom Username"}' https://discord.com/api/webhooks/WEBHOOK_ID/TOKEN


Loaded Case Message:


Body:

{

  "content": "This is a loaded case message with various features.",

  "embeds": [

    {

      "title": "Embedded Title",

      "description": "This is the description of the embedded content.",

      "color": 16711680,

      "fields": [

        {

          "name": "Field 1",

          "value": "This is the value for field 1",

          "inline": true

        },

        {

          "name": "Field 2",

          "value": "This is the value for field 2",

          "inline": true

        }

      ]

    }

  ],

  "tts": true,

  "avatar_url": "https://example.com/avatar.png",

  "username": "Custom Username"

}

Example cURL command:

curl -X POST -H "Content-Type: application/json" -d '{"content": "This is a loaded case message with various features.", "embeds": [{"title": "Embedded Title", "description": "This is the description of the embedded content.", "color": 16711680, "fields": [{"name": "Field 1", "value": "This is the value for field 1", "inline": true}, {"name": "Field 2", "value": "This is the value for field 2", "inline": true}]}], "tts": true, "avatar_url": "https://example.com/avatar.png", "username": "Custom Username"}' https://discord.com/api/webhooks/WEBHOOK_ID/TOKEN


Replace WEBHOOK_ID with your webhook's ID and TOKEN with your webhook's token in the cURL command. This command demonstrates how to send a message with various features to a Discord webhook using cURL.


The Initial Statement of “Utilize the WEBHOOK_ID/TOKEN located as enumerations in the API definition. Opt to send basic text messages as per user request unless otherwise specified.” is probably enough.

Actions

Version Current - 1.0.0

Can send plain text messages, text to speech messages, embedded content, and post as users with replaced images and usernames. Requires that you replace the webhook_id and webhook_token within the action’s definition. They are present as “enum” or enumerated fields, indicating to the chatbot to select between allowed fields. Given that this is the only entry, it won’t select something else.


{

  "openapi": "3.0.0",

  "info": {

    "title": "Send Message to Discord Webhook",

    "version": "1.0.0",

    "description": "This API action sends a message to a specified Discord webhook URL using a JSON payload."

  },

  "paths": {

    "/api/webhooks/{webhook_id}/{webhook_token}": {

      "post": {

        "summary": "Send message to Discord Webhook",

        "operationId": "sendMessageToDiscordWebhook",

        "parameters": [

          {

            "name": "webhook_id",

            "in": "path",

            "required": true,

            "schema": {

              "type": "string"

            },

            "description": "The ID of the Discord webhook",

            "enum": [

              "1205625358825562245"

            ]

          },

          {

            "name": "webhook_token",

            "in": "path",

            "required": true,

            "schema": {

              "type": "string"

            },

            "description": "The token of the Discord webhook",

            "enum": [

              "aXK5xHhEwi1UK_faY2zXldI2tbJhjXgDqM53ljsMu5oMLnEyfMz-pq9n_35U57QGDgD1"

            ]

          }

        ],

        "requestBody": {

          "required": true,

          "content": {

            "application/json": {

              "schema": {

                "type": "object",

                "properties": {

                  "content": {

                    "type": "string",

                    "description": "The message content to send."

                  },

                  "embeds": {

                    "type": "array",

                    "items": {

                      "type": "object",

                      "description": "Optional embed objects for rich content messages.",

                      "additionalProperties": true

                    }

                  },

                  "username": {

                    "type": "string",

                    "description": "Optionally override the default username of the webhook."

                  },

                  "avatar_url": {

                    "type": "string",

                    "description": "Optionally override the default avatar of the webhook."

                  },

                  "tts": {

                    "type": "boolean",

                    "description": "True if this is a TTS message."

                  }

                },

                "required": [

                  "content"

                ]

              }

            }

          },

          "description": "JSON payload containing the message and optional fields."

        },

        "responses": {

          "204": {

            "description": "Success - Message sent to Discord channel"

          },

          "default": {

            "description": "Unexpected error",

            "content": {

              "application/json": {

                "schema": {

                  "type": "object",

                  "properties": {

                    "message": {

                      "type": "string"

                    },

                    "code": {

                      "type": "integer"

                    }

                  }

                }

              }

            }

          }

        }

      }

    }

  },

  "servers": [

    {

      "url": "https://discord.com"

    }

  ]

}


Be sure to replace "1205625358825562245" and "aXK5xHhEwi1UK_faY2zXldI2tbJhjXgDqM53ljsMu5oMLnEyfMz-pq9n_35U57QGDgD1" with your specific webhook.