menu button

Optional calls

Shorten, Extend and Rephrase Agenda Items

Shorten, Extend and Rephrase Agenda Items

Use these mutations to generate shortened, extended, or rephrased suggestions for an agenda item. After selecting a result, call updateAgendaItemById and insert the chosen text into the appropriate textList entry for the desired depth level.

Follow these 3 steps:

  1. Call shortenAgendaItem, extendAgendaItem, or rephraseAgendaItem — this triggers an async task that can take some time.
  2. Poll getRephraseElementByProtocolSlug every 5 seconds until refactoredSuggestion is non-empty.
  3. Call updateAgendaItemById with the chosen suggestion text.

Common input parameters:

  • agendaItemId (String!) — ID of the agenda item to modify.
  • userInput (String) — optional for Shorten/Extend, required for Rephrase. Use it to guide tone, length, and style (e.g. "formal", "bullet points", "max 30 words").

ShortenAgendaItem

Generates shorter, more concise versions of an agenda item.


GraphQL Mutation

mutation ShortenAgendaItem($agendaItemId: String!, $userInput: String) {
  shortenAgendaItem(agendaItemId: $agendaItemId, userInput: $userInput) {
    rephraseElement {
      id
      status
      userInput
      rephraseType
    }
  }
}

Mutation Variables

{
  "agendaItemId": "AGENDA_ITEM_ID",
  "userInput": "Summarize in one concise sentence suitable for a meeting overview."
}

Example JavaScript Implementation

import axios from "axios";

export async function shortenAgendaItem(agendaItemId, userInput = null) {
  const res = await axios.post(
    "https://api-v2.speechmind.com/external/v2/graphql",
    { query: SHORTEN_AGENDA_ITEM, variables: { agendaItemId, userInput } },
    { headers: { "Content-Type": "application/json", "x-api-key": process.env.SPEECHMIND_API_KEY } }
  );

  return res.data.data.shortenAgendaItem.rephraseElement;
}

ExtendAgendaItem

Creates expanded or more detailed versions of the agenda item.


GraphQL Mutation

mutation ExtendAgendaItem($agendaItemId: String!, $userInput: String) {
  extendAgendaItem(agendaItemId: $agendaItemId, userInput: $userInput) {
    rephraseElement {
      id
      status
      userInput
      rephraseType
    }
  }
}

Mutation Variables

{
  "agendaItemId": "AGENDA_ITEM_ID",
  "userInput": "Add background, rationale and next steps in 3 short bullet points."
}

Example JavaScript Implementation

import axios from "axios";

export async function extendAgendaItem(agendaItemId, userInput = null) {
  const res = await axios.post(
    "https://api-v2.speechmind.com/external/v2/graphql",
    { query: EXTEND_AGENDA_ITEM, variables: { agendaItemId, userInput } },
    { headers: { "Content-Type": "application/json", "x-api-key": process.env.SPEECHMIND_API_KEY } }
  );

  return res.data.data.extendAgendaItem.rephraseElement;
}

RephraseAgendaItem

Rewrites the agenda item according to the instructions in userInput. userInput is mandatory — the mutation will throw if it is missing.


GraphQL Mutation

mutation RephraseAgendaItem($agendaItemId: String!, $userInput: String!) {
  rephraseAgendaItem(agendaItemId: $agendaItemId, userInput: $userInput) {
    rephraseElement {
      id
      status
      userInput
      rephraseType
    }
  }
}

Mutation Variables

{
  "agendaItemId": "AGENDA_ITEM_ID",
  "userInput": "Rewrite in a neutral professional tone, avoid names, and make it one paragraph."
}

Example JavaScript Implementation

import axios from "axios";

export async function rephraseAgendaItem(agendaItemId, userInput) {
  if (!userInput) throw new Error("userInput is required for rephraseAgendaItem");

  const res = await axios.post(
    "https://api-v2.speechmind.com/external/v2/graphql",
    { query: REPHRASE_AGENDA_ITEM, variables: { agendaItemId, userInput } },
    { headers: { "Content-Type": "application/json", "x-api-key": process.env.SPEECHMIND_API_KEY } }
  );

  return res.data.data.rephraseAgendaItem.rephraseElement;
}

GetRephraseElementByProtocolSlug

Poll this query every 5 seconds after triggering any of the mutations above. Stop once refactoredSuggestion is non-empty.


GraphQL Query

query GetRephraseElementByProtocolSlug($protocolSlug: String!) {
  getRephraseElementByProtocolSlug(protocolSlug: $protocolSlug) {
    agendaItemId
    agendaItemDepth
    refactoredSuggestion
  }
}

Example JavaScript Implementation

import axios from "axios";

async function pollRephraseResult(protocolSlug, intervalMs = 5000) {
  while (true) {
    const res = await axios.post(
      "https://api-v2.speechmind.com/external/v2/graphql",
      { query: GET_REPHRASE_ELEMENT_BY_PROTOCOL_SLUG, variables: { protocolSlug } },
      { headers: { "Content-Type": "application/json", "x-api-key": process.env.SPEECHMIND_API_KEY } }
    );

    const result = res.data.data.getRephraseElementByProtocolSlug;

    if (result.refactoredSuggestion && result.refactoredSuggestion.length > 0) {
      return result;
    }

    await new Promise((resolve) => setTimeout(resolve, intervalMs));
  }
}

Notes

  • refactoredSuggestion contains a list of suggestion strings generated from the userInput and the existing agenda item content.
  • Example userInput values: Shorten — "Shorten to 12 words, keep key action and decision." / Extend — "Add rationale and two next steps in bullets." / Rephrase — "Neutral tone, remove personal references, use formal language."

Have questions?

Still have questions? Talk to support.