menu button

Optional calls

Get Transcript by Protocol & Page

Get Transcript by Protocol & Page

Use the getTextsegmentsByProtocolAndPage query to fetch transcript segments for a given protocol, paginated. One page contains 30 textsegment objects.


Input Parameters

  • protocolSlug (String!) — identifier of the protocol.
  • page (Int!) — page number to fetch. Starts at 0.

GraphQL Query

fragment transcriptDetails on TranscriptSegment {
  text
  startTime
  endTime
}

fragment speakerDetails on ApiSpeakerType {
  slug
  givenName
  familyName
  preTitle
  postTitle
  gender
  party
  posLong
  posShort
  systemId
}

query GetTextsegmentsByProtocolAndPage($protocolSlug: String!, $page: Int!) {
  getTextsegmentsByProtocolAndPage(protocolSlug: $protocolSlug, page: $page) {
    textsegmentList {
      id
      speakerObj {
        ...speakerDetails
      }
      textJson {
        ...transcriptDetails
      }
      pos
    }
  }
}

Query Variables

{
  "protocolSlug": "PROTOCOL_SLUG",
  "page": 0
}

Example JavaScript Implementation

import axios from "axios";

async function getTranscriptByProtocolAndPage(protocolSlug, page) {
  const res = await axios({
    method: "POST",
    url: "https://api-v2.speechmind.com/external/v2/graphql",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": process.env.SPEECHMIND_API_KEY,
    },
    data: JSON.stringify({
      query: GET_TRANSCRIPT_BY_PROTOCOL_AND_PAGE,
      variables: { protocolSlug, page },
    }),
  });

  return res.data.data.getTextsegmentsByProtocolAndPage;
}

Notes

  • Each page contains up to 30 textsegment objects. Increment page to paginate through the full transcript.
  • Each textsegment includes speaker metadata (speakerObj) and timestamped word-level data (textJson).

Have questions?

Still have questions? Talk to support.