Discord multiline slash options: send a script to Sume Avatar
Discord string options now accept multiline input. Use one for an avatar script and post it to Sume's talking-video endpoint with an interaction-keyed id.
How do you take a multi-line script from a Discord slash command and turn it into a Sume avatar video? Discord's September 11 changelog entry says string options for slash commands now support multiline input, and autocomplete gets fuzzy search (read 2026-10-04). A script with line breaks used to be awkward to type into a single-line option. Now it fits, and the text goes straight to Sume's talking-video endpoint.
The shape is: the bot acknowledges the interaction quickly, submits one Sume job keyed by the interaction id, and replies with the job id. The video arrives later, through a webhook or a poll.
What the endpoint needs
Sume's talking-video endpoint is POST /v1/avatar-1.0/talking-video. It takes an avatar_handle and exactly one of script or video_inputs. Sending both, or neither, is a request error. When you send a script, the text must estimate to between 4 and 60 seconds of speech. Aspect ratio defaults to 9:16 and quality to plus, and the output resolution is 720p.
A Discord option has its own limits, so validate before you spend: reject an empty script, and trim it. If the script is too short or too long for the estimate, the API will refuse it, so show that error back to the person instead of retrying.
| Field | Value in this bot | Note |
|---|---|---|
avatar_handle | set in the bot's config | Which avatar speaks |
script | the multiline option text | Exactly one of script or video_inputs |
aspect_ratio | default 9:16 | Change only if the channel needs it |
Idempotency-Key header | discord-<interaction id> | A retry returns the original job |
The handler
The function below takes the interaction id and the script from the parsed command and submits the job. It builds the idempotency key from the interaction id, so if Discord redelivers the interaction or your process retries after a network error, Sume returns the original job rather than starting a second paid one. It refuses to run without a key and prints the status and job body.
Reusing a key with a different body returns 409 idempotency_conflict; with a key tied to the interaction id, that only happens if you change the script between retries.
const API = 'https://api.sume.com/v1/avatar-1.0/talking-video';
export async function submitScript(interactionId, script) {
const key = process.env.SUME_API_KEY;
if (!key) throw new Error('SUME_API_KEY is not set');
const text = String(script || '').trim();
if (!text) throw new Error('script is empty');
const res = await fetch(API, {
method: 'POST',
headers: {
'x-api-key': key,
'content-type': 'application/json',
'idempotency-key': 'discord-' + interactionId,
},
body: JSON.stringify({
avatar_handle: process.env.SUME_AVATAR_HANDLE,
script: text,
}),
});
const body = await res.json();
if (!res.ok) throw new Error(res.status + ' ' + JSON.stringify(body.error));
return body;
}
submitScript('demo-1', 'Hello from the channel.\nThis is line two.')
.then((b) => console.log(JSON.stringify(b)))
.catch((e) => console.error(e.message));Timing: reply fast, deliver later
Discord expects an initial response to an interaction within a few seconds, and the follow-up token lasts 15 minutes. A render will not finish inside either window, so defer the reply, submit the job, and post the job id. The post on the 15-minute interaction token and Sume format runs covers the follow-up side in detail.
A 202 means accepted, not finished. Poll GET /v1/jobs/:id/status, waiting next_poll_after_seconds between checks, or set the job to webhook mode and let job.completed call you. Verify the webhook signature, which is an HMAC SHA256 over the timestamp, a period and the raw body, before you post the video link.
Keep the script option honest
Multiline input makes it easy to paste a long text, so tell people the limit in the option description: a script that estimates past 60 seconds is refused. Keep the key on the server, never in a message, and rotate it if it ever appears in a channel. For the image-first variant of this bot, see the attachment option post, and for the basic bot, Discord bot AI video generation.
Sources
Related posts
More in Integrations
- Evaluating a video MCP server: five checks, with Runway as context
Runway shipped MCP and plugin channels on Sep 17, 22, 23 and Oct 1. Before you connect any video MCP server, check scopes, idempotency, spend caps and waits.
- fal lists Seedream 5.0 and Krea 2: find what Sume's image catalog has
fal.ai/models names GPT Image 2.5, Flux 2, Nano Banana 2, Ideogram 4, Krea 2 and Seedream 5.0. A Python check of which names appear in Sume's /v1/images/models.
- Sheets 20 million cells: how many Sume jobs can a ledger hold?
Google Sheets doubled its cell limit to 20 million. Work out how many Sume job rows fit by column count, and why GET /v1/jobs stays the system of record.
- Sheets manual calculation: keep paid Sume calls out of formulas
Google Sheets can now pause automatic recalculation. Keep Sume job submits in a menu-driven Apps Script, not formulas, so a recalc never buys a render.
Written by Sume