menu button

Chapter 5: Export Word Document

Export Word Document

After successfully creating your document using our AI, you can easily export it as a Word document. Follow this simple tutorial to guide you through the process:


Api Endpoint for Word Export

Request Body for Word Export API Call

  • protocolSlug: A unique identifier (slug) for the protocol (meeting or document) you want to export.
  • documentName: The name to give the exported Word document (without file extension).
{
  "protocolSlug": "<unique_protocol_slug>",
  "documentName": "Testmeeting-SpeechMind"
}

Example Curl Request

curl --location 'https://api-v2.speechmind.com/external/v1/word-export' \
--header 'x-api-key: <YOUR_API_KEY_HERE>' \
--header 'Content-Type: application/json' \
--data '{
  "protocolSlug": "<unique_protocol_slug>",
  "documentName": "Testmeeting-SpeechMind"
}'

Example JS Code

import axios from "axios";

export async function exportWordDocument(protocolSlug: string, documentName: string) {
  const dataObj = {
    protocolSlug,
    documentName,
  };

  try {
    const response = await axios({
      method: "post",
      url: "https://api-v2.speechmind.com/external/v1/word-export", // Set this in your .env file
      data: JSON.stringify(dataObj),
      headers: {
        "Content-Type": "application/json",
        "x-api-key": "<YOUR_API_KEY_HERE>", // Set this in your .env file
      },
    });

    // The response data is the file content
    const file = response.data;

    //additional details from the response headers
    const headers = response.headers;
    const contentType = headers["content-type"];
    const date = headers["date"];
    const attendees = headers["attendees"];
    const agendaItemTitiles = headers["agenda-item-titles"];
    const fileName = headers["file-name"];
    const protocolOwner = headers["protocol-owner"];

    return response.data;
  } catch (error) {
    console.error("Failed to export Word document:", error);
    throw error;
  }
}


exportWordDocument("<unique_protocol_slug>", "Testmeeting-SpeechMind")

After calling the exportWordDocument method, you can retrieve the file from the response data. Additionally, you can fetch more details about the file by checking the response headers. These headers include the following:

  • date: The date the document was created.
  • attendees: A list of the attendees who were present at the meeting.
  • agenda-item-titles: An array of the agenda item titles, which can contain multiple titles.
  • file-name: The name of the document.
  • protocol-owner: The individual who owns the protocol.

Have questions?

Still have questions? Talk to support.