IMPORTANT: This tutorial expects that you’ve already done the ping command tutorial so you can understand the basics of making flows, placing blocks, and inserting variables.
In this tutorial, we will be building a simple button that sends a message when clicked.
Step 1 - Set Slash Command Trigger
Flow triggers decide what action will start your flow. In this case, we want the button to appear after we send a message with a slash command.
Step 2 - Set Command Name and Description
Set an appropriate command name and description.
We’re using send-button as the command name and Create a button that sends a message. as the description, but you can set it to anything you want.
The user will be clicking the button to send a message, not from the command itself, so we don’t need to set any command options.
Step 3 - Add Button Builder Block
Now that we have the Slash Command trigger, we need to add the button. To do this, we’ll use the Embed Button Builder block.
Click the Add Block button, and select Embed Button Builder.
Once you add the block, fill in one or more of the buttons with a label, style, and custom ID.
Step 4 - Add Interaction Response Block
Now that we have the button, we need to send it to the user. To do this, we’ll use the Embed Reply to Interaction block.
Click the Add Block button, and select Embed Reply to Interaction.
Once you add the block, find the Button Builder Data field, click Insert Variable, and add the Button Data output from the Embed Button Builder block.
You also need to set the Content or Body fields to something, so we used Click the button below to send a message! as a prompt.
Step 5 - Create a New Flow
Now that we have the button, we need to create a new flow that will handle the user’s click.
To do this, go to the Components page and create a new flow. We’d suggest calling it something like Button Handler.
Step 6 - Set Button Click Trigger
Once you’ve created the new flow, you need to set the trigger to Button Click.
Set the Button ID to the same ID you used in the Embed Button Builder block, which is example in our case.
Step 7 - Add Interaction Response Block
Now that we have the Button Click trigger, we need to send a message back to the user. To do this, we’ll use the Text Reply to Interaction block.
Click the Add Block button, and select Text Reply to Interaction.
For our example, we used You clicked the button! as the message content.
Step 8 - You’re Done!
Go over to Discord to test it out. It should pop up in the slash command menu, and you should be able to click the button to send a message.
If it isn’t showing up, click on the Slash Command trigger at the top of the first flow, and click Sync Command. It can take up to 5 minutes, but restarting your Discord client should force it to show up.
If you’re confused or have any issues, ask in Support. We’re happy to help!