Button Click
Triggers when a button below a message is clicked.
This trigger is based on Discord event InteractionCreate.
Inputs
Inputs have not yet been documented.
Outputs
Interaction ID
Interaction Token
Server ID
Channel ID
Executing User ID
Button ID
Message ID
Context Type
App Permissions
\
More information
The Button pressed trigger supports prefixing meaning you can have many paths (buttons) triggering the same flow and make the one flow. The following examples can be used and modified for use with the dropdown and modal trigger
Use Cases
Button prefixes can be used for anything from a simple action like pinging a user to more advanced actions like transferring data between flows
Examples
For the following examples, we are going to assume a prefix of “`prefix`” with the goal of kicking or banning a server member
A slash command with a select user dropdown was used and a user with the ID of 1250528195858665493
was selected. From there, the slash command provides 2 buttons with the following IDs using the following format; {prefix}*{action}*{user}
prefix*kick*1250528195858665493
prefix*ban*1250528195858665493
In both buttons, the prefix and user are the same with the difference being the action. This means you can easily get the action by putting the Button ID into a String Split List block
If the ban button is pressed, the String Split List outputs will be as follows
String 1) prefix*
String 2) ban
String 3) 1250528195858665493
Using the outputs (String 2 in this case), we can select a different action to preform depending on the specific button pressed all from within the same flow by using an If Statement. For banning a member you would want to check if the second string is equal to “ban” then execute a Ban Server Member block with the third string (User ID) in the server the button was pressed in and send a reply