Confbrew: A Getting Started Tutorial with Markprompt and Contenda
Tags: ai, conferences, content, tutorial
Published: 2023-04-06 23:11:51

---
title: Confbrew: A Getting Started Tutorial with Markprompt and Contenda
published: true
date: 2023-04-05 00:00:00 UTC
tags: ai, conferences, content, tutorial
canonical_url: https://blog.brainstory.ai/markprompt-tutorial/
cover_image: https://images.unsplash.com/photo-1495474472287-4d71bcdd2085?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1740&q=80
---

This tutorial was generated by [Contenda](https://contenda.co/) from our [video tutorial on the subject](https://youtu.be/WtZqHj9cjGs). If you’d prefer to watch, head over there!

## Uploading a YouTube playlist using Contenda APIs

In this tutorial, you’ll learn how to convert a YouTube playlist into a Q&A bot. We’ll use the [Contentful Fast Forward 2022 Conference playlist](https://www.youtube.com/watch?v=7eZIEztVCk0&list=PLAaQpb7XfX3Bo3dVHdD6rB09HvyvhA0zO) as an example.

1. Open this [Autocode Template](https://autocode.com/contenda/templates/contenda-markprompt/)
2. Hit `Run` on `main.js`

This file will grab the playlist ID from the YouTube URL and call the Google YouTube API endpoint to get all the video IDs. Then it will call the Contenda API, which takes the video IDs and generates tutorials in Markdown format. These tutorials can later be converted into a Q&A using Markprompt.

```js
const lib = require('lib')({ token: process.env.STDLIB });
const { google } = require('googleapis');
const apiKey = process.env.apiKey;
const playlistUrl = 'https://www.youtube.com/watch?v=_tLJRAl';

// Extract the playlist ID from the URL
const playlistId = playlistUrl.split('list=')[1];

// Function to get video IDs from a playlist
async function getPlaylistVideoIds(playlistId) {
  const youtube = google.youtube({
    version: 'v3',
    auth: apiKey
  });

  const response = await youtube.playlistItems.list({
    key: apiKey,
    part: 'snippet',
    maxResults: 50,
    playlistId
  });

  const videoIds = response.data.items.map(
    (item) => item.snippet.resourceId.videoId
  );

  console.log(videoIds);
  return videoIds
}
```

Afterwards:

1. Wait for Contenda to process the jobs (depending on the playlist length and video size, this can take a few hours)
2. In the `receive_jobs.js` logs, observe the jobs being queued up and processed.

## Integrating Contenda and Markprompt

When a job is successful, the Contenda endpoint sends back the status as “success” along with the job ID. We store this job ID, call the Contenda API to get the blog ID, and then create a paired array. Our `receive_jobs.js` file now created job IDs paired with blog IDs in local key-value storage.

Next, we need to modify our `markprompt.js` file. First, change the Markprompt key to match the project you’re using. Sign up for Markprompt, create a project, and generate a token in the settings. After adding the Markprompt key, save the environmental variable.

![Markprompt UI screenshot to get the project key](https://contenda.co/blogimages/markprompt_tutorial_key.jpg)

The goal is to create key-value pairs where the keys are the blog IDs, and the values are JSON objects containing the markdown from the content. Contenda provides a “retrieve as markdown” endpoint that returns markdown for a given blog ID. Simply stringify the returned object and add it to the `files` array.

Markprompt can then accept this JSON array and train on it. Run the code and verify if you receive a 200 status response. Go back to Markprompt and check the “Data” tab, where you should see all of your videos as blog IDs.

![Markprompt UI screenshot of the data tab](https://contenda.co/blogimages/markprompt_tutorial_data.jpg)

## You did it!

In order to search through video content effectively, you are now all set up to use a combination of Contenda and Markprompt APIs!

With these tools, you can access valuable information that might be locked up within videos, like customer panels, which may not be easily searchable on platforms like YouTube.

You can [join our Discord](https://discord.gg/bYda4pQz2v) for help or feedback. We’d love to hear from you.

Happy shipping!