K
Docs
API ReferenceEvent TypesButton pressed
🔘

Button pressed

componentClickINTERACTION_CREATE (MESSAGE_COMPONENT)Trigger

Fires when someone presses a button your bot sent. Match it to the button's custom id. Works in Interaction Only mode.

On the canvas

This is what the trigger looks like in your bot's Triggers tab. The sparks listed are available in every node inside the linked flow.

🔘
Button pressed
componentClick
Trigger
Sparks in this flow
{{input.guild.id}}Your Discord server's unique ID
{{input.guild.name}}Your server's name
{{input.guild.memberCount}}How many members are in the server
{{component.customId}}The custom id of the button or dropdown that was used
{{component.args}}Anything after the colon in the custom id — how you carry data through a click
{{component.user.id}}Discord ID of whoever clicked
{{component.user.username}}Username of whoever clicked
{{component.messageId}}ID of the message the button is on
{{component.channelId}}ID of the channel the message is in

Available sparks

Use these in any piece config field inside flows triggered by this event.

SparkTypeDescription
{{input.guild.id}}stringYour Discord server's unique ID
{{input.guild.name}}stringYour server's name
{{input.guild.memberCount}}stringHow many members are in the server
{{component.customId}}stringThe custom id of the button or dropdown that was used
{{component.args}}stringAnything after the colon in the custom id — how you carry data through a click
{{component.user.id}}stringDiscord ID of whoever clicked
{{component.user.username}}stringUsername of whoever clicked
{{component.messageId}}stringID of the message the button is on
{{component.channelId}}stringID of the channel the message is in
📐

In TypeScript, this would be…

Not something you need to write — Kitcord registers these listeners automatically from your Kit.

TypeScript
client.on("componentClick", () => { /* your flow */ });