Appearance
Buttons, dropdowns and forms
Put buttons, link buttons and dropdowns under your plugin's posts, and open a form when someone clicks. Dissent draws all of them in its own style — you give labels, ids, options and URLs, never markup. Every click goes to your plugin with the clicker's identity from their Dissent node.
Putting components on a post
From a server half (post() in the server SDK), a command's public reply, or the frame (Dissent.postMessage, needs bot:post):
javascript
// server half
import { post } from "./server-sdk.js"; // the server SDK, bundled into your module
post(channelId, "Lunch vote — pick one", { components: [
{ type: "button", id: "pizza", label: "Pizza", style: "primary" },
{ type: "button", id: "sushi", label: "Sushi" },
{ type: "link", label: "Menu", url: "https://example.com/menu" },
{ type: "select", id: "time", placeholder: "When?", options: [
{ label: "12:00", value: "12" }, { label: "13:00", value: "13" } ] },
] });
// frame
await Dissent.postMessage("Lunch vote", { components: [{ type: "button", id: "pizza", label: "Pizza" }] });| Type | Fields | Notes |
|---|---|---|
button | id, label, style (primary · secondary · success · danger), disabled | A click goes to your plugin |
link | label, url (https only), disabled | Opens in the browser; Dissent shows the real domain under the label. Your plugin is not told |
select | id, options [{label, value, description}], placeholder, min_values, max_values, disabled | The value(s) picked go to your plugin |
Limits: up to 5 rows; a row holds up to 5 buttons/links or one dropdown (up to 25 options). Ids are yours (1–100 characters, unique on the post); labels up to 80. A flat list is laid out for you; or pass rows: [[…], […]]. Dissent's node checks all of it — a post with components it refuses is refused (frame) or posted without them with a note (command reply).
Answering a click
With a server half, the node runs it with trigger "interaction"; read it with interaction():
javascript
import { interaction, output } from "./server-sdk.js"; // the server SDK, bundled into your module
const ix = interaction(); // null when this run is something else
// { kind: "button" | "select" | "form", component_id, values, form_id, fields, origin,
// message: { id, channel_id } | null, channel_id, user: { id, name } | null, viewer }
if (ix?.component_id === "pizza") {
output({
content: "Counted — only you see this", // a private line
update: { content: "Lunch vote — 1 for pizza", // change the post that was clicked
components: [{ type: "button", id: "pizza", label: "Pizza", disabled: true }] },
});
}Answer with any mix of:
"text"or{ content }— only the person who clicked sees it. Addcomponentsand the private reply gets buttons too: Dissent signs them and draws them on the "only you" card; a click on one comes back to you like any other click (withmessage: null), and anupdatethen changes that card.{ content, visibility: "public", components }— a new post as your plugin (needsbot:post).{ update: { content?, components? } }— change the post that was clicked (only ever your own).components: []takes them off;disabled: truegreys one out and the node refuses clicks on it.{ form: { … } }— open a form (below).
Without a server half, Dissent opens your panel and calls Dissent.onInteraction. Return the same answers a server half can — text, { content, visibility, components }, { update } (your own post that was clicked) or { form } — and the node carries them out with the same checks:
javascript
Dissent.onInteraction((ix) => ix.component_id === "pizza"
? { content: "Noted!", update: { content: "Lunch vote — pizza is winning" } }
: undefined);Slow answers: "thinking…" and follow-ups
A server half has about 2 seconds to answer a command, click or Send-to. When it needs longer, answer { defer: true }:
- the member sees "(your plugin) is thinking…" at once — privately, or as a post of yours when the answer will be public (
{ defer: true, visibility: "public" }or a public command); - Dissent runs your server half again with the same input plus
deferred: trueandfollowup(a token), and up to 5 seconds. What you answer then replaces "thinking…". A deferred run cannot defer again.
javascript
const cmd = command();
if (cmd && !cmd.deferred) output({ defer: true });
else if (cmd) output(`Weather in ${cmd.options.city}: ${fetchJSON(api(cmd.options.city)).summary}`);For 15 minutes, any later run of yours (an event, a webhook, another command) may answer that member again with the token — { followups: [{ token, content?, components?, update? }] } — and any run may change your own earlier posts with { edits: [{ message_id, content?, components? }] } (up to 3 of each per run; only your plugin's posts, never anyone else's). A private follow-up reaches only the member who asked, and only the browser tab they asked from.
Forms
Answer a click — or a command — with a form and Dissent opens its own pop-up of up to 5 text fields:
javascript
output({ form: { id: "signup", title: "Sign up", fields: [
{ id: "name", label: "Your name", required: true, max_length: 40 },
{ id: "why", label: "Why?", style: "paragraph", placeholder: "Optional" },
] } });Field options: style (short · paragraph), required, placeholder, value (pre-filled), min_length, max_length (≤ 4000). Title and labels up to 45 characters.
When they press Send your server half runs again with kind: "form", form_id and fields ({ name: "…", why: "" }). A form can only be opened in answer to that person's click or command — the node signs it for them, for 15 minutes — and a form cannot answer a form.
Who clicked
user is { id, name } from the clicker's Dissent node — a visitor from another node included. Someone who chose View without joining for your plugin reaches it as an anonymous viewer (user: null, viewer: true). The first time someone uses your plugin's components Dissent tells them "Clicking tells (your plugin) who you are".
Limits and where it works
- 30 clicks a minute per person per plugin (three times the server's command limit), then "slow down".
- Works for members visiting from another node, for plugins mirrored from another node's market, on phones, and in encrypted channels — your posts there are plaintext from the node and marked "not encrypted", and a click tells your plugin only which button.
- The node checks every click against the post as stored: the component must be on it and not turned off, a dropdown value must be one of its options, the post must be your plugin's own.