{"id":46815,"date":"2024-10-30T00:00:00","date_gmt":"2024-10-30T07:00:00","guid":{"rendered":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/blog\/automate-slide-creation-using-openai-and-node-js\/"},"modified":"2026-03-30T11:48:19","modified_gmt":"2026-03-30T18:48:19","slug":"automate-slide-creation-using-openai-and-node-js","status":"publish","type":"post","link":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/","title":{"rendered":"Automate Slide Creation Using OpenAI and Node.js"},"content":{"rendered":"<p>With the rise of AI tools, we can automate many manual workloads, including creating presentation slides. Developers can generate slide content programmatically by leveraging OpenAI&#8217;s language models and Node.js. This automation surely will save time. By using OpenAI for content generation and Node.js for orchestration, you can effortlessly streamline the process of creating compelling and informative presentations.<\/p>\n<p>In this post, we will use the Assistant API model from OpenAI to automate slide content creation, Node.js to create the slide document, and GridDB to save the slide information.<\/p>\n<h2>Running the Project<\/h2>\n<p>Clone the source code from this <a href=\"https:\/\/github.com\/griddbnet\/Blogs\/tree\/slides\">GitHub repository<\/a>.<\/p>\n<div class=\"clipboard\">\n<pre><code>git clone https:\/\/github.com\/griddbnet\/Blogs.git --branch slides<\/code><\/pre>\n<\/div>\n<p>You also need to install <a href=\"#1-installing-nodejs\">Node.js<\/a> and <a href=\"#2-setting-up-griddb\">GridDB<\/a> for this project to run. If the software requirements are installed, change the directory to the <code>apps<\/code> project directory and then install all the dependencies:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">cd apps\nnpm install <\/code><\/pre>\n<\/div>\n<p>Create a <code>.env<\/code> file and copy all environment variables from the <code>.env.example<\/code> file. You need an OpenAI key for this project, please look in <a href=\"#3-setup-openai-keys\">this section<\/a> on how to get the key.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">OPENAI_API_KEY=sk-proj-secret\nVITE_APP_URL=http:\/\/localhost:3000<\/code><\/pre>\n<\/div>\n<p>You can change the <code>VITE_APP_URL<\/code> to your needs and then run the project by running this command:<\/p>\n<div class=\"clipboard\">\n<pre><code>npm run start:build<\/code><\/pre>\n<\/div>\n<p>Then open the browser and go to the app URL. Select the data sample and then click the <strong>Create Slide<\/strong> button.<\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/create-slide-button.png\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/create-slide-button.png\" alt=\"\" width=\"1780\" height=\"892\" class=\"aligncenter size-full wp-image-30746\" srcset=\"\/wp-content\/uploads\/2024\/10\/create-slide-button.png 1780w, \/wp-content\/uploads\/2024\/10\/create-slide-button-300x150.png 300w, \/wp-content\/uploads\/2024\/10\/create-slide-button-1024x513.png 1024w, \/wp-content\/uploads\/2024\/10\/create-slide-button-768x385.png 768w, \/wp-content\/uploads\/2024\/10\/create-slide-button-1536x770.png 1536w, \/wp-content\/uploads\/2024\/10\/create-slide-button-600x301.png 600w, \/wp-content\/uploads\/2024\/10\/create-slide-button-1280x640.png 1280w\" sizes=\"(max-width: 1780px) 100vw, 1780px\" \/><\/a><\/p>\n<p>If the slide presentation is created successfully, a download link will be provided.<\/p>\n<h2>Getting Started<\/h2>\n<h3>1. Installing Node.js<\/h3>\n<p>This project will run on the Node.js platform. You need to install it from <a href=\"https:\/\/nodejs.org\/en\/download\">here<\/a>. For this project, we will use the <code>nvm<\/code> package manager and Node.js v16.20.2<br \/>\nLTS version.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\"># installs nvm (Node Version Manager)\ncurl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.39.7\/install.sh | bash\n\n# download and install Node.js\nnvm install 16\n\n# verifies the right Node.js version is in the environment\nnode -v # should print `v16.20.2`\n\n# verifies the right NPM version is in the environment\nnpm -v # should print `8.19.4``<\/code><\/pre>\n<\/div>\n<p>To connect Node.js and GridDB database, you need the <a href=\"https:\/\/github.com\/nodejs\/node-addon-api\">gridb-node-api<\/a> npm package which is a Node.js binding developed using GridDB C Client and Node addon API.<\/p>\n<h3>2. Setting Up GridDB<\/h3>\n<p>We will use the GridDB database to save recipes and it&#8217;s nutrition analysis. Please look at the <a href=\"https:\/\/docs.griddb.net\/latest\/gettingstarted\/using-apt\/#install-with-apt-get\">guide<\/a> for detailed installation. We will use Ubuntu 20.04 LTS here.<\/p>\n<p>Run GridDB and check if the service is running. Use this command:<\/p>\n<div class=\"clipboard\">\n<pre><code>sudo systemctl status gridstore<\/code><\/pre>\n<\/div>\n<p>If not running try to run the database with this command:<\/p>\n<div class=\"clipboard\">\n<pre><code>sudo systemctl start gridstore<\/code><\/pre>\n<\/div>\n<h3>3. Setup OpenAI Keys<\/h3>\n<p>The OpenAI key is on a project basis, so we need to create a project first in the OpenAI platform.<\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/create-openai-project.png\"><img decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/create-openai-project.png\" alt=\"\" width=\"2038\" height=\"966\" class=\"aligncenter size-full wp-image-30756\" srcset=\"\/wp-content\/uploads\/2024\/10\/create-openai-project.png 2038w, \/wp-content\/uploads\/2024\/10\/create-openai-project-300x142.png 300w, \/wp-content\/uploads\/2024\/10\/create-openai-project-1024x485.png 1024w, \/wp-content\/uploads\/2024\/10\/create-openai-project-768x364.png 768w, \/wp-content\/uploads\/2024\/10\/create-openai-project-1536x728.png 1536w, \/wp-content\/uploads\/2024\/10\/create-openai-project-600x284.png 600w\" sizes=\"(max-width: 2038px) 100vw, 2038px\" \/><\/a><\/p>\n<p>To access any OpenAI services, you need a valid key. Go to this <a href=\"https:\/\/platform.openai.com\/api-keys\">link<\/a> and create a new OpenAI key, make sure to select the right project.<\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/create-api-key.png\"><img decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/create-api-key.png\" alt=\"\" width=\"2112\" height=\"1308\" class=\"aligncenter size-full wp-image-30755\" srcset=\"\/wp-content\/uploads\/2024\/10\/create-api-key.png 2112w, \/wp-content\/uploads\/2024\/10\/create-api-key-300x186.png 300w, \/wp-content\/uploads\/2024\/10\/create-api-key-1024x634.png 1024w, \/wp-content\/uploads\/2024\/10\/create-api-key-768x476.png 768w, \/wp-content\/uploads\/2024\/10\/create-api-key-1536x951.png 1536w, \/wp-content\/uploads\/2024\/10\/create-api-key-2048x1268.png 2048w, \/wp-content\/uploads\/2024\/10\/create-api-key-600x372.png 600w\" sizes=\"(max-width: 2112px) 100vw, 2112px\" \/><\/a><\/p>\n<p>You need also to enable any models that you use on a project. For this project, we will need the <code>gpt-4o<\/code> model. Go to the project settings and then select which models to be enabled.<\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/models.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/models.png\" alt=\"\" width=\"3020\" height=\"1514\" class=\"aligncenter size-full wp-image-30749\" srcset=\"\/wp-content\/uploads\/2024\/10\/models.png 3020w, \/wp-content\/uploads\/2024\/10\/models-300x150.png 300w, \/wp-content\/uploads\/2024\/10\/models-1024x513.png 1024w, \/wp-content\/uploads\/2024\/10\/models-768x385.png 768w, \/wp-content\/uploads\/2024\/10\/models-1536x770.png 1536w, \/wp-content\/uploads\/2024\/10\/models-2048x1027.png 2048w, \/wp-content\/uploads\/2024\/10\/models-600x301.png 600w\" sizes=\"(max-width: 3020px) 100vw, 3020px\" \/><\/a><\/p>\n<p>You should save the OpenAI key on the <code>.env<\/code> file and make sure not to include it in version control by adding it to the <code>.gitignore<\/code>.<\/p>\n<h3>4. Setup AI Assistant<\/h3>\n<p>This project needs an AI assistant. You need to set it first, go to the project dashboard, and create a new assistant.<\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/create-ai-assistant.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/create-ai-assistant.png\" alt=\"\" width=\"3020\" height=\"1702\" class=\"aligncenter size-full wp-image-30754\" srcset=\"\/wp-content\/uploads\/2024\/10\/create-ai-assistant.png 3020w, \/wp-content\/uploads\/2024\/10\/create-ai-assistant-300x169.png 300w, \/wp-content\/uploads\/2024\/10\/create-ai-assistant-1024x577.png 1024w, \/wp-content\/uploads\/2024\/10\/create-ai-assistant-768x433.png 768w, \/wp-content\/uploads\/2024\/10\/create-ai-assistant-1536x866.png 1536w, \/wp-content\/uploads\/2024\/10\/create-ai-assistant-2048x1154.png 2048w, \/wp-content\/uploads\/2024\/10\/create-ai-assistant-150x85.png 150w, \/wp-content\/uploads\/2024\/10\/create-ai-assistant-600x338.png 600w\" sizes=\"(max-width: 3020px) 100vw, 3020px\" \/><\/a><\/p>\n<p>You need to pay attention to the <strong>Instruction<\/strong> field because it will dictate the behavior of the AI assistant. This is the instruction used for this assistant:<\/p>\n<div class=\"clipboard\">\n<pre><code>You are a data scientist assistant. When given data and a query, write the proper code and create the proper visualization.<\/code><\/pre>\n<\/div>\n<p>Another setup is you need to enable <strong>Code Interpreter<\/strong>, which means the assistant will be able to execute code in a sandbox environment, enabling your prompt to execute code. For more information on this feature, please click <a href=\"https:\/\/developers.openai.com\/api\/docs\/assistants\/tools\/code-interpreter\">here<\/a>.<\/p>\n<p>After the AI assistant creation, you need to copy the assistant ID. This ID will be used as a reference in the code where you can send messages to the assistant.<\/p>\n<div class=\"clipboard\">\n<pre><code>const dataScienceAssistantId = \"asst_FOqRnMVXw0WShTSGw70NZJAX\"<\/code><\/pre>\n<\/div>\n<h2>Data Examples<\/h2>\n<p>This project will use JSON data samples from car spare parts sales. The data reside in the <code>data<\/code> directory. This is <a href=\"https:\/\/github.com\/junwatu\/ai-slides-creator\/blob\/main\/apps\/data\/spare-part-sales-2020-2024.json\">the spare part sales data for the year 2020 to the year 2024<\/a>:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">[\n {\n  \"Year\": 2020,\n  \"Quarter\": \"Q1\",\n  \"Distribution channel\": \"Online Sales\",\n  \"Revenue ($M)\": 2.10,\n  \"Costs ($M)\": 1.905643,\n  \"Customer count\": 190,\n  \"Time\": \"2020 Q1\",\n  \"Product Category\": \"Engine Parts\",\n  \"Region\": \"North America\",\n  \"Units Sold\": 900,\n  \"Average Sale Price ($)\": 2333,\n  \"Discounts Given ($)\": 14000,\n  \"Returns ($)\": 4500,\n  \"Customer Satisfaction Rating\": 8.2,\n  \"Salesperson\": \"SP120\",\n  \"Marketing Spend ($)\": 18000\n },\n {\n  \"Year\": 2020,\n  \"Quarter\": \"Q1\",\n  \"Distribution channel\": \"Direct Sales\",\n  \"Revenue ($M)\": 2.15,\n  \"Costs ($M)\": 2.004112,\n  \"Customer count\": 200,\n  \"Time\": \"2020 Q1\",\n  \"Product Category\": \"Brakes\",\n  \"Region\": \"Europe\",\n  \"Units Sold\": 1000,\n  \"Average Sale Price ($)\": 2150,\n  \"Discounts Given ($)\": 12000,\n  \"Returns ($)\": 5000,\n  \"Customer Satisfaction Rating\": 8.0,\n  \"Salesperson\": \"SP121\",\n  \"Marketing Spend ($)\": 19000\n },\n ...\n {\n  \"Year\": 2024,\n  \"Quarter\": \"Q2\",\n  \"Distribution channel\": \"Direct Sales\",\n  \"Revenue ($M)\": 3.15,\n  \"Costs ($M)\": 2.525112,\n  \"Customer count\": 390,\n  \"Time\": \"2024 Q2\",\n  \"Product Category\": \"Brakes\",\n  \"Region\": \"Europe\",\n  \"Units Sold\": 1500,\n  \"Average Sale Price ($)\": 2095,\n  \"Discounts Given ($)\": 22000,\n  \"Returns ($)\": 17000,\n  \"Customer Satisfaction Rating\": 9.1,\n  \"Salesperson\": \"SP144\",\n  \"Marketing Spend ($)\": 38000\n }\n]<\/code><\/pre>\n<\/div>\n<p>Ideally, the data should be uploaded via the user interface. However, for simplicity in this project, the data will be directly processed when you choose the data samples from the data samples dropdown.<\/p>\n<p><strong>How can OpenAI process the file directly?<\/strong><\/p>\n<p>The answer is, that you need to upload manually the data sample files first. Go to the project dashboard and upload the files.<\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/upload-files.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/upload-files.png\" alt=\"\" width=\"2364\" height=\"1410\" class=\"aligncenter size-full wp-image-30751\" srcset=\"\/wp-content\/uploads\/2024\/10\/upload-files.png 2364w, \/wp-content\/uploads\/2024\/10\/upload-files-300x179.png 300w, \/wp-content\/uploads\/2024\/10\/upload-files-1024x611.png 1024w, \/wp-content\/uploads\/2024\/10\/upload-files-768x458.png 768w, \/wp-content\/uploads\/2024\/10\/upload-files-1536x916.png 1536w, \/wp-content\/uploads\/2024\/10\/upload-files-2048x1222.png 2048w, \/wp-content\/uploads\/2024\/10\/upload-files-600x358.png 600w\" sizes=\"(max-width: 2364px) 100vw, 2364px\" \/><\/a><\/p>\n<p>You need to pay attention to the purpose of the uploaded files. In this project, the data sample files are used as <strong>assistants<\/strong> files.<\/p>\n<p>Later these file IDs will be used to identify which file is used when the user selects the data sample from the dropdown.<\/p>\n<h2>Generating Content<\/h2>\n<p>When the user selects the data sample and clicks the <strong>Create Slide<\/strong> button. The Assistant API will generate the image and text for the content slide. These are a few important steps in the code to generate the slide content:<\/p>\n<h3>1. Analyze Data Samples<\/h3>\n<p>OpenAI will analyze the selected data sample then it will calculate the profit by quarter and year then visualize the plot.<\/p>\n<p>The prompt for this process is:<\/p>\n<div class=\"clipboard\">\n<pre><code>const analyzeDataPrompt = \"Calculate the profit (revenue minus cost) by quarter and year, and visualize as a line plot across the distribution channels, where the colors of the lines are green, light red, and light blue\"<\/code><\/pre>\n<\/div>\n<p>And this code will process the prompt and the selected file (see <code>fileId<\/code>)<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-js\"> const thread = await openai.beta.threads.create({\n  messages: [\n   {\n    \"role\": \"user\",\n    \"content\": analyzeDataPrompt,\n    \"attachments\": [\n     {\n      file_id: fileId,\n      tools: [{ type: \"code_interpreter\" }]\n     }\n    ]\n   }\n  ]\n });<\/code><\/pre>\n<\/div>\n<p>From this code, you can get the plot image. It will be saved in the public directory and will be used in the slide content.<\/p>\n<h3>2. Generate Bullet Points<\/h3>\n<p>The AI Assistant will give an insight into the data and will generate bullet points. This is the prompt to instruct AI to give two insights about the data:<\/p>\n<div class=\"clipboard\">\n<pre><code>const insightPrompt = `Give me two medium-length sentences (~20-30 words per sentence) of the most important insights from the plot you just created, and save each sentence as an item in one array. Give me a raw array, no formatting, no commentary. These will be used for a slide deck, and they should be about the 'so what' behind the data.`<\/code><\/pre>\n<\/div>\n<h3>3. Generate Insight Title<\/h3>\n<p>The last step is generating a title for the insight. This is the prompt that is responsible for that:<\/p>\n<div class=\"clipboard\">\n<pre><code>const titlePrompt = \"Given the plot and bullet point you created, come up with a very brief title only for a slide. It should reflect just the main insights you came up with.\"<\/code><\/pre>\n<\/div>\n<p>The full code for generating slide content is in the <a href=\"https:\/\/github.com\/junwatu\/ai-slides-creator\/blob\/main\/apps\/libs\/ai.js\"><code>libs\/ai.js<\/code><\/a> file.<\/p>\n<h2>Generate Slides<\/h2>\n<p>This project uses the <a href=\"https:\/\/gitbrent.github.io\/PptxGenJS\/\">PptxGenJS<\/a> package to generate the slides. You can look at the full code in the <code>libs\/pptx.js<\/code> file.<\/p>\n<p>This is the code that calls the <code>createPresentation()<\/code> function when all the AI-generated slide information is ready.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-js\">\/\/...\nif (bulletPointsSummary.status === \"completed\") {\n                    const message = await openai.beta.threads.messages.list(thread.id)\n                    const dataVisTitle = message.data[0].content[0].text.value\n\n                    presentationOptions = {\n                        title: slideTitle,\n                        subtitle: slideSubtitle,\n                        dataVisTitle: dataVisTitle,\n                        chartImagePath: path.join(__dirname, \"public\", `${filename}`),\n                        keyInsights: \"Key Insights:\",\n                        bulletPoints: bulletPoints,\n                        outputFilename: path.join(__dirname, 'public', pptxFilename)\n                    };\n\n                    try {\n                        createPresentation(presentationOptions)\n                    } catch (error) {\n                        console.log(error)\n                    }\n}\n\/\/...<\/code><\/pre>\n<\/div>\n<p>Just note that the generated presentation file will be saved in the <code>public<\/code> directory with each a unique name.<\/p>\n<h2>Slides Information<\/h2>\n<p>To save the slide information, we will use the GridDB database. These are the database field&#8217;s documentation:<\/p>\n<table>\n<thead>\n<tr>\n<th>Field Name<\/th>\n<th>Type<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>id<\/td>\n<td>INTEGER<\/td>\n<td>A unique identifier for each record. This is the primary key for the container and must be unique for each entry.<\/td>\n<\/tr>\n<tr>\n<td>title<\/td>\n<td>STRING<\/td>\n<td>The main title of the slide. It is a short descriptive title summarizing the content of the slide.<\/td>\n<\/tr>\n<tr>\n<td>subtitle<\/td>\n<td>STRING<\/td>\n<td>A secondary title or subheading providing additional context or a brief description related to the main title.<\/td>\n<\/tr>\n<tr>\n<td>chartImage<\/td>\n<td>STRING<\/td>\n<td>The URL or path to an image of a chart associated with the slide, used to link visual data representations.<\/td>\n<\/tr>\n<tr>\n<td>bulletPoints<\/td>\n<td>STRING<\/td>\n<td>A string containing bullet points that summarize key information or highlights of the slide. Each bullet point is typically separated by a special character or newline.<\/td>\n<\/tr>\n<tr>\n<td>pptx<\/td>\n<td>STRING<\/td>\n<td>The URL or path to the PowerPoint file (.pptx) that contains the slide, used to link the presentation file including the slide.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The <code>griddbservices.js<\/code> and <code>libs\/griddb.js<\/code> files are responsible for saving all the slide information to the database.<\/p>\n<h2>Server Routes<\/h2>\n<p>The Node.js server provides a few routes for the client. This is the full documentation for the routes:<\/p>\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Route<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>GET<\/td>\n<td><code>\/<\/code><\/td>\n<td>Serves the <code>index.html<\/code> file from the &#8216;dist&#8217; folder<\/td>\n<\/tr>\n<tr>\n<td>GET<\/td>\n<td><code>\/create\/:fileId<\/code><\/td>\n<td>Triggers the AI assistant to process a file and create a presentation. Returns the save status and PPTX file name<\/td>\n<\/tr>\n<tr>\n<td>GET<\/td>\n<td><code>\/metadata<\/code><\/td>\n<td>Serves the <code>metadata.json<\/code> file from the <code>data<\/code> directory<\/td>\n<\/tr>\n<tr>\n<td>GET<\/td>\n<td><code>\/data\/files<\/code><\/td>\n<td>Lists all JSON filenames in the <code>data<\/code> directory<\/td>\n<\/tr>\n<tr>\n<td>GET<\/td>\n<td><code>\/data\/files\/:filename<\/code><\/td>\n<td>Serves a specific JSON file from the <code>data<\/code> directory<\/td>\n<\/tr>\n<tr>\n<td>GET<\/td>\n<td><code>\/slides<\/code><\/td>\n<td>Retrieves all slides data from the database<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The most important route is <code>\/create\/:fileId<\/code> which triggers the AI assistant to analyze data samples, create a presentation, and then save all slide information to the database.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-js\">app.get('\/create\/:fileId', async (req, res) => {\n const fileId = req.params.fileId\n\n try {\n  const result = await aiAssistant(fileId)\n\n  if (result.status === \"completed\") {\n   const {\n    title: titlePptx,\n    subtitle: subtitlePptx,\n    dataVisTitle: dataVisTitlePptx,\n    chartImage: chartImagePptx,\n    bulletPoints: bulletPointsPptx,\n    outputFilename: pptxFile\n   } = result.data\n\n   const saveDataStatus = await saveData({ titlePptx, subtitlePptx, dataVisTitlePptx, chartImagePptx, bulletPointsPptx, pptxFile })\n\n   res.json({\n    save: saveDataStatus,\n    data: result.data,\n    pptx: result.pptx\n   })\n  } else {\n   res.status(500).json({\n    error: 'Task not completed', status: result.status\n   })\n  }\n\n } catch (error) {\n  console.error('Error in AI Assistant:', error)\n  res.status(500).json({ error: 'Error in AI Assistant', details: error.message })\n }\n})<\/code><\/pre>\n<\/div>\n<p>The <code>aiAssistant()<\/code> function will analyze the data sample, create a presentation return all information about the slide, and then save those slide information to the GridDB database using the <code>saveData()<\/code> function.<\/p>\n<p>To get all the slide data just go to the <code>\/slides<\/code> route and it will respond with all slide data saved in the database.<\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/slide-data.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/slide-data.png\" alt=\"\" width=\"1315\" height=\"640\" class=\"aligncenter size-full wp-image-30750\" srcset=\"\/wp-content\/uploads\/2024\/10\/slide-data.png 1315w, \/wp-content\/uploads\/2024\/10\/slide-data-300x146.png 300w, \/wp-content\/uploads\/2024\/10\/slide-data-1024x498.png 1024w, \/wp-content\/uploads\/2024\/10\/slide-data-768x374.png 768w, \/wp-content\/uploads\/2024\/10\/slide-data-600x292.png 600w\" sizes=\"(max-width: 1315px) 100vw, 1315px\" \/><\/a><\/p>\n<h2>User Interface<\/h2>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/user-interface.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2024\/10\/user-interface.png\" alt=\"\" width=\"1519\" height=\"847\" class=\"aligncenter size-full wp-image-30752\" srcset=\"\/wp-content\/uploads\/2024\/10\/user-interface.png 1519w, \/wp-content\/uploads\/2024\/10\/user-interface-300x167.png 300w, \/wp-content\/uploads\/2024\/10\/user-interface-1024x571.png 1024w, \/wp-content\/uploads\/2024\/10\/user-interface-768x428.png 768w, \/wp-content\/uploads\/2024\/10\/user-interface-150x85.png 150w, \/wp-content\/uploads\/2024\/10\/user-interface-600x335.png 600w\" sizes=\"(max-width: 1519px) 100vw, 1519px\" \/><\/a><\/p>\n<p>The main user interface consists of two components:<\/p>\n<ul>\n<li><strong>Data Dropdown<\/strong>: To select a data sample.<\/li>\n<li><strong>Create Slide Button<\/strong>: To trigge presentation creation.<\/li>\n<li><strong>Download Generated Presentation Link<\/strong>: The download link for the presentation <code>.pptx<\/code> file.<\/li>\n<\/ul>\n<h2>Further Enhancements<\/h2>\n<p>This is a prototype project with static data samples. Ideally, in production, you need to provide a better user interface to upload the data and customize the prompt.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the rise of AI tools, we can automate many manual workloads, including creating presentation slides. Developers can generate slide content programmatically by leveraging OpenAI&#8217;s language models and Node.js. This automation surely will save time. By using OpenAI for content generation and Node.js for orchestration, you can effortlessly streamline the process of creating compelling and [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":30753,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[121],"tags":[],"class_list":["post-46815","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Automate Slide Creation Using OpenAI and Node.js | GridDB: Open Source Time Series Database for IoT<\/title>\n<meta name=\"description\" content=\"With the rise of AI tools, we can automate many manual workloads, including creating presentation slides. Developers can generate slide content\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automate Slide Creation Using OpenAI and Node.js | GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"og:description\" content=\"With the rise of AI tools, we can automate many manual workloads, including creating presentation slides. Developers can generate slide content\" \/>\n<meta property=\"og:url\" content=\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/\" \/>\n<meta property=\"og:site_name\" content=\"GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/griddbcommunity\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-30T07:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-30T18:48:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/wp-content\/uploads\/2024\/10\/cover.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1792\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"griddb-admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:site\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"griddb-admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/\"},\"author\":{\"name\":\"griddb-admin\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\"},\"headline\":\"Automate Slide Creation Using OpenAI and Node.js\",\"datePublished\":\"2024-10-30T07:00:00+00:00\",\"dateModified\":\"2026-03-30T18:48:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/\"},\"wordCount\":1345,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2024\/10\/cover.jpg\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/\",\"url\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/\",\"name\":\"Automate Slide Creation Using OpenAI and Node.js | GridDB: Open Source Time Series Database for IoT\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2024\/10\/cover.jpg\",\"datePublished\":\"2024-10-30T07:00:00+00:00\",\"dateModified\":\"2026-03-30T18:48:19+00:00\",\"description\":\"With the rise of AI tools, we can automate many manual workloads, including creating presentation slides. Developers can generate slide content\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#primaryimage\",\"url\":\"\/wp-content\/uploads\/2024\/10\/cover.jpg\",\"contentUrl\":\"\/wp-content\/uploads\/2024\/10\/cover.jpg\",\"width\":1792,\"height\":1024},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/griddb.net\/en\/#website\",\"url\":\"https:\/\/griddb.net\/en\/\",\"name\":\"GridDB: Open Source Time Series Database for IoT\",\"description\":\"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL\",\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/griddb.net\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/griddb.net\/en\/#organization\",\"name\":\"Fixstars\",\"url\":\"https:\/\/griddb.net\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"contentUrl\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"width\":200,\"height\":83,\"caption\":\"Fixstars\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/griddbcommunity\/\",\"https:\/\/x.com\/GridDBCommunity\",\"https:\/\/www.linkedin.com\/company\/griddb-by-toshiba\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\",\"name\":\"griddb-admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g\",\"caption\":\"griddb-admin\"},\"url\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/author\/griddb-admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Automate Slide Creation Using OpenAI and Node.js | GridDB: Open Source Time Series Database for IoT","description":"With the rise of AI tools, we can automate many manual workloads, including creating presentation slides. Developers can generate slide content","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/","og_locale":"en_US","og_type":"article","og_title":"Automate Slide Creation Using OpenAI and Node.js | GridDB: Open Source Time Series Database for IoT","og_description":"With the rise of AI tools, we can automate many manual workloads, including creating presentation slides. Developers can generate slide content","og_url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/","og_site_name":"GridDB: Open Source Time Series Database for IoT","article_publisher":"https:\/\/www.facebook.com\/griddbcommunity\/","article_published_time":"2024-10-30T07:00:00+00:00","article_modified_time":"2026-03-30T18:48:19+00:00","og_image":[{"width":1792,"height":1024,"url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/wp-content\/uploads\/2024\/10\/cover.jpg","type":"image\/jpeg"}],"author":"griddb-admin","twitter_card":"summary_large_image","twitter_creator":"@GridDBCommunity","twitter_site":"@GridDBCommunity","twitter_misc":{"Written by":"griddb-admin","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#article","isPartOf":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/"},"author":{"name":"griddb-admin","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233"},"headline":"Automate Slide Creation Using OpenAI and Node.js","datePublished":"2024-10-30T07:00:00+00:00","dateModified":"2026-03-30T18:48:19+00:00","mainEntityOfPage":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/"},"wordCount":1345,"commentCount":0,"publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"image":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2024\/10\/cover.jpg","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/","url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/","name":"Automate Slide Creation Using OpenAI and Node.js | GridDB: Open Source Time Series Database for IoT","isPartOf":{"@id":"https:\/\/griddb.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#primaryimage"},"image":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2024\/10\/cover.jpg","datePublished":"2024-10-30T07:00:00+00:00","dateModified":"2026-03-30T18:48:19+00:00","description":"With the rise of AI tools, we can automate many manual workloads, including creating presentation slides. Developers can generate slide content","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/automate-slide-creation-using-openai-and-node-js\/#primaryimage","url":"\/wp-content\/uploads\/2024\/10\/cover.jpg","contentUrl":"\/wp-content\/uploads\/2024\/10\/cover.jpg","width":1792,"height":1024},{"@type":"WebSite","@id":"https:\/\/griddb.net\/en\/#website","url":"https:\/\/griddb.net\/en\/","name":"GridDB: Open Source Time Series Database for IoT","description":"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL","publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/griddb.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/griddb.net\/en\/#organization","name":"Fixstars","url":"https:\/\/griddb.net\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/","url":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","contentUrl":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","width":200,"height":83,"caption":"Fixstars"},"image":{"@id":"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/griddbcommunity\/","https:\/\/x.com\/GridDBCommunity","https:\/\/www.linkedin.com\/company\/griddb-by-toshiba"]},{"@type":"Person","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233","name":"griddb-admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g","caption":"griddb-admin"},"url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/author\/griddb-admin\/"}]}},"_links":{"self":[{"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/posts\/46815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/comments?post=46815"}],"version-history":[{"count":2,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/posts\/46815\/revisions"}],"predecessor-version":[{"id":55104,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/posts\/46815\/revisions\/55104"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/media\/30753"}],"wp:attachment":[{"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/media?parent=46815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/categories?post=46815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/wp-json\/wp\/v2\/tags?post=46815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}