DEV Community

Cover image for Confbrew: A Getting Started Tutorial with Markprompt and Contenda
Lilly for Contenda

Posted on • Originally published at on

Confbrew: A Getting Started Tutorial with Markprompt and Contenda

This tutorial was generated by Contenda from our video tutorial on the subject. 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 as an example.

  1. Open this Autocode Template
  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.

const lib = require('lib')({ token: process.env.STDLIB });
const { google } = require('googleapis');
const apiKey = process.env.apiKey;
const playlistUrl = '';

// 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 ={
    version: 'v3',
    auth: apiKey

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

  const videoIds =
    (item) => item.snippet.resourceId.videoId

  return videoIds
Enter fullscreen mode Exit fullscreen mode


  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

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

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 for help or feedback. We’d love to hear from you.

Happy shipping!

Top comments (1)

lilchenzo profile image
Lilly • Edited

Stoked about this! Let me know if you have any questions :D