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.

5 min readSume
All posts

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.

Talking-video request fields used here (read 2026-10-04)
FieldValue in this botNote
avatar_handleset in the bot's configWhich avatar speaks
scriptthe multiline option textExactly one of script or video_inputs
aspect_ratiodefault 9:16Change only if the channel needs it
Idempotency-Key headerdiscord-<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

All Integrations posts

Written by Sume