@frogbotai/piece-discord connects an agent to Discord. When the agent uses the question tool, participants answer with buttons and menus in the conversation.
Connect an agent
discord. Give each instance its own slug when you connect more than one application.
Discord has no OAuth recipe, so the factory does not accept
oauth. See factory options for slug and auth.
Where the bot replies
Create the Discord application
- In the Discord Developer Portal, create an application and add a bot. Copy the bot token.
- Set Interactions Endpoint URL to
https://your-app.example.com/api/webhooks/<instance>. Discord sends button and menu clicks there, and FrogBot verifies each one with the public key. - Under Bot, turn on the Message Content intent. FrogBot needs it to read messages, including typed answers.
- Invite the bot with the View Channels, Send Messages, Send Messages in Threads, Create Public Threads, and Read Message History permissions.
frogbot channels:run.
Who can answer
Discord does not share email addresses, so FrogBot cannot match a Discord member to a FrogBot user. Every Discord participant arrives without a FrogBot user, and the default agentaccess check, which requires a signed-in user, denies them all. Write an access function for every agent that uses Discord.
req.context.channel.author holds the Discord user id, username, and display name. The example above admits a fixed list of Discord user IDs. To admit a role instead, look up the member with the Discord API in your access function and check their roles.
Anyone who passes the check can answer, including a teammate who did not start the conversation. FrogBot records the Discord user on the answer. Someone who fails the check and clicks a control gets a short reply in the thread that mentions them, and the question stays open. Messages from someone who fails the check are ignored.
What participants see
Each question appears as a card in the thread, sent in Discord’s components v2 message format. The agent’s other replies are ordinary messages.
Every card has a Dismiss button. Dismissing tells the agent the question was declined and stops the turn.
When the agent asks several questions in one call, the card shows them one at a time, with progress such as
2 of 3 and the answers so far. When the agent makes several question calls in one step, their cards appear one after another.
When a question is answered, the card is replaced with the answers and Answered by the participant’s display name and username, and the agent continues in the same thread. The first answer wins.
Questions are answered only in Discord. The FrogBot admin chat shows the conversation read-only.
Typed answers
Discord cannot open a form after a click, so typed answers are messages in the thread. Press Other…, and the card shows that you are typing. Your next message in the thread, sent within 10 minutes, becomes your answer. You do not need to mention the bot. Press Other… again to cancel. Only the person who pressed Other… is captured. Messages from anyone else reach the agent as usual and are handled after the question is answered. For a question that allows several choices, the picks you made before pressing Other… are kept and sent with your typed answer.Picks in a menu
Picks in a menu that accepts several options stay private to each participant until they press Submit, and Submit sends only that participant’s picks. Discord resets the menus whenever the card changes, for example when someone presses Other… or changes page, and FrogBot forgets the picks that Discord reset. Picks on other pages are kept.Limits and failures
Discord expects a response to a click within 3 seconds. FrogBot records the answer and updates the card before it responds, and runs the agent’s next step as a job. If that takes longer, Discord shows “This interaction failed” even though the answer was recorded and the card updates.
Notices are thread replies that mention one participant. Discord offers private replies only through a click’s own response, which FrogBot uses to acknowledge the click.