menu button

Optional calls

Shorten, Extend and Rephrase Agenda Items

Use the APIs below 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.

To run the rephrasing of certain content, follow these 3 steps:

  1. Call shortenAgendaItem, extendAgendaItem, or rephraseAgendaItem — this triggers an asynchronous task in the background which can take some time.
  2. Poll getRephraseElementByProtocolSlug every 5 seconds. If refactoredSuggestion is [], try again in 5 seconds. Otherwise use the value.
  3. Call updateAgendaItemById with the chosen text from the query.

Quick rules:

  • agendaItemId (String, required) — id of the agenda item to modify.
  • userInput (String) — optional for Shorten/Extend, required for Rephrase. Use it to guide tone, length, and constraints (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
    }
  }
}

Variables

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

JavaScript Example

import axios from "axios";

const SHORTEN_AGENDA_ITEM = `
  mutation ShortenAgendaItem($agendaItemId: String!, $userInput: String) {
    shortenAgendaItem(agendaItemId: $agendaItemId, userInput: $userInput) {
      rephraseElement {
        id
        status
        userInput
        rephraseType
      }
    }
  }
`;

export async function shortenAgendaItem(agendaItemId, userInput = null) {
  const dataObj = { query: SHORTEN_AGENDA_ITEM, variables: { agendaItemId, userInput } };

  const res = await axios.post("https://api-v2.speechmind.com/external/v2/graphql", dataObj, {
    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
    }
  }
}

Variables

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

JavaScript Example

import axios from "axios";

const EXTEND_AGENDA_ITEM = `
  mutation ExtendAgendaItem($agendaItemId: String!, $userInput: String) {
    extendAgendaItem(agendaItemId: $agendaItemId, userInput: $userInput) {
      rephraseElement {
        id
        status
        userInput
        rephraseType
      }
    }
  }
`;

export async function extendAgendaItem(agendaItemId, userInput = null) {
  const dataObj = { query: EXTEND_AGENDA_ITEM, variables: { agendaItemId, userInput } };

  const res = await axios.post("https://api-v2.speechmind.com/external/v2/graphql", dataObj, {
    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 here — the mutation will throw if it’s missing.

GraphQL Mutation

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

Variables

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

JavaScript Example

import axios from "axios";

const REPHRASE_AGENDA_ITEM = `
  mutation RephraseAgendaItem($agendaItemId: String!, $userInput: String!) {
    rephraseAgendaItem(agendaItemId: $agendaItemId, userInput: $userInput) {
      rephraseElement {
        id
        status
        userInput
        rephraseType
      }
    }
  }
`;

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

  const dataObj = { query: REPHRASE_AGENDA_ITEM, variables: { agendaItemId, userInput } };

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

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

Tips and examples for userInput

  • 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.”

GetRephraseElementByProtocolSlug

Poll this query every 5 seconds after triggering a shorten/extend/rephrase mutation. Stop once refactoredSuggestion is non-empty.

GraphQL Query

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

JavaScript Example (polling)

import axios from "axios";

const GET_REPHRASE_ELEMENT_BY_PROTOCOL_SLUG = `
  query GetRephraseElementByProtocolSlug($protocolSlug: String!) {
    getRephraseElementByProtocolSlug(protocolSlug: $protocolSlug) {
      agendaItemId
      agendaItemDepth
      refactoredSuggestion
    }
  }
`;

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));
  }
}
  • refactoredSuggestion contains a list of suggestion strings generated from the userInput and the existing agenda item content.

Have questions?

Still have questions? Talk to support.