Button Click

Interaction triggerInteractions

Triggers when a user clicks a button.

  • Interaction trigger: the flow can reply to the user directly, with messages, modals and more.

Options

Custom IDRequired

The custom ID of the button to listen for. Supports `*` wildcard matching (e.g. `ticket_*`, `*_approve`, or `ticket_*_approve`).

Example: my_button

Outputs

Custom ID

The custom ID of the button that was clicked.

Example: my_button

Wildcard Value

If the Custom ID input uses a single `*` wildcard, this is the matched portion of the clicked button Custom ID.

Example: 123

User ID

ID of the user who clicked the button.

Example: 123456789012345678

Username

Username of the user who clicked the button.

Example: johndoe

User Avatar URL

Avatar URL of the user who clicked the button.

Example: https://cdn.discordapp.com/avatars/123/abc.png

Channel ID

Channel where the button was clicked.

Example: 123456789012345678

Server ID

Server where the button was clicked.

Example: 123456789012345678

Application ID

ID of the application that received this interaction.

Example: 123456789012345678

Interaction ID

Unique interaction ID for this button click.

Example: 123456789012345678

Interaction Token

Token for this interaction, useful for webhook follow-up/edit operations.

Example: aW50ZXJhY3Rpb25fdG9rZW4

App Permissions

Permissions the bot/application had in the interaction channel, as a Discord bitfield string.

Example: 274877990912

User Locale

Discord locale of the user who clicked the button.

Example: en-US

Server Locale

Preferred locale of the server where the button was clicked, when available.

Example: en-US

Interaction Context

Where the interaction was used (`server`, `bot_dm`, or `private_channel`).

Example: server

Message ID

ID of the message the button is attached to.

Example: 123456789012345678

Build a bot using triggers like Button Click

Use this trigger in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.

Advanced Documentation

This documentation can be useful when using code mode. View as Markdown

ID: button_click
  • Interaction trigger: blocks that respond to interactions (replies, modals, ...) can be used in its flows.

Options

FieldInventScript nameValue
Custom IDcustom_ide.g. "my_button"

Outputs

FieldInventScript nameValue
Custom IDcustom_ide.g. "my_button"
Wildcard Valuewildcard_valuee.g. "123"
User IDuser_ide.g. "123456789012345678"
Usernameusernamee.g. "johndoe"
User Avatar URLuser_avatare.g. "https://cdn.discordapp.com/avatars/123/abc.png"
Channel IDchannel_ide.g. "123456789012345678"
Server IDserver_ide.g. "123456789012345678"
Application IDapplication_ide.g. "123456789012345678"
Interaction IDinteraction_ide.g. "123456789012345678"
Interaction Tokeninteraction_tokene.g. "aW50ZXJhY3Rpb25fdG9rZW4"
App Permissionsapp_permissionse.g. "274877990912"
User Localeuser_localee.g. "en-US"
Server Localeserver_localee.g. "en-US"
Interaction Contextinteraction_contexte.g. "server"
Message IDmessage_ide.g. "123456789012345678"

Example InventScript

var trigger = button_click(Args{custom_id: "my_button"})

func main() {
	send_text_message(Args{
		channel_id:      trigger.channel_id,
		message_content: "Custom ID: " + trigger.custom_id,
	})
}

More interactions triggers