Skip to content

Listen Notes ChatGPT Plugin for AI-powered podcast search. Powered by PodcastAPI.com and Cloudflare Pages.

License

Notifications You must be signed in to change notification settings

double-bluffing/listennotes-chatgpt-plugin

 
 

Repository files navigation

Listen Notes ChatGPT Plugin

This repository contains the source code for the Listen Notes ChatGPT plugin. This plugin is built with PodcastAPI.com and deployed on serverless Cloudflare Pages using JavaScript. It allows users to interact with the Listen Notes Podcast Database through the ChatGPT interface. Users can search for podcasts, find episodes, get recommendations, and more.

Table of Contents

Using the Plugin

To use the Listen Notes ChatGPT plugin, you'll need to enable the plugin on chat.openai.com first:

Screenshot 2023-06-19 at 12 16 11 PM

You can try prompts like these:

  • "what are some recent podcast episodes talking about Sam Altman, in English"
  • "give me a random podcast episode to listen"
  • "how many episodes does the daily podcast have"
  • "有哪些好的中文播客,关于犯罪的"
  • "find me some podcasts about charles manson"
Screenshot 2023-06-19 at 10 18 30 AM

Running Locally

To run this repo on your local development environment, follow these steps:

0) Install Cloudflare Wrangler

npm install -g wrangler

1) Clone the repository to your local machine.

git clone https://github.com/ListenNotes/listennotes-chatgpt-plugin.git

2) Install the necessary dependencies.

yarn install

3) Create a .dev.vars file in the root directory of this project (at the same level as package.json).

Put these variables in the .dev.vars file:

LISTEN_API_KEY = "your_podcast_api_key_from_podcastapi.com"

CHATGPT_SECRET = "your_custom_secret_which_is_like_a_password"
CHATGPT_VERIFICATION_TOKEN = "a_secret_generated_on_chat.openai.com"
NODE_VERSION = '17'
Variables Description Required for dev?
LISTEN_API_KEY API key for Podcast API, which can be obtained at listennotes.com/api/pricing Yes
CHATGPT_SECRET A custom secret for interacting with proxy endpoints defined in functions/api/v2 Yes
CHATGPT_VERIFICATION_TOKEN A verification token generated on chat.openai.com. For dev purposes, you can put a random string or leave it blank for now. No
NODE_VERSION Pin the nodejs version to 17.0, which is to make Cloudflare Pages happy. No

4) Test the proxy endpoints

Run the dev server first:

yarn dev

Then use curl to send a request (Note: Replace $CHATGPT_SECRET with the value that you set in the .dev.vars file):

curl -X GET --location "http://localhost:8788/api/v2/search_podcasts?q=nba" \
    -H "Authorization: Bearer $CHATGPT_SECRET"

Adapting the Plugin

This plugin can be adapted to work with other APIs. To do this, you'll need to modify the endpoints and the corresponding functions in the code.

Specifically, you'll need to change three things:

  1. Update ai-plugin.json: Learn more on openai.com.

  2. Update proxy endpoints with other APIs: Those proxy endpoints are running on Cloudflare Pages edge to send API requests. You may want to learn how Cloudflare Pages functions work first.

  3. Update openapi.json: ChatGPT relies on this openapi spec to know what proxy endpoints are available. You may want to learn more on openai.com.

Deploying to Production

To deploy the Listen Notes ChatGPT plugin to production on Cloudflare Pages, follow these steps:

  1. Create a Cloudflare Pages project

You'll setup deployment configuration like this:

Screenshot 2023-06-19 at 11 35 53 AM

And setup environment variables:

Screenshot 2023-06-19 at 11 36 46 AM

Note: At first, you may just put a random string for CHATGPT_VERIFICATION_TOKEN because you'll get the real verification token later from openapi.com.

And setup custom domain for your Cloudflare Pages project:

Screenshot 2023-06-19 at 11 43 43 AM
  1. Test on chat.openai.com

Go to the Plugin store:

Screenshot 2023-06-19 at 11 42 42 AM

And follow the instructions to setup your plugin:

Screenshot 2023-06-19 at 11 45 18 AM

You'll see the verification token, then go back to the Cloudflare Pages dashboard to setup the value of CHATGPT_VERIFICATION_TOKEN (you can delete the old variable and add a new one):

Screenshot 2023-06-19 at 11 47 33 AM

To make your Cloudflare Pages project pick up the new CHATGPT_VERIFICATION_TOKEN value, you'll have to redeploy:

Screenshot 2023-06-19 at 11 48 45 AM

Then go back to the ChatGPT UI to verify the verification token.

By this point, you should be able to test your plugin on chat.openai.com.

Submit for review

To list your plugin on the Plugin Store, please refer to the guidelines provided on this page for submitting your plugin for review.

About

Listen Notes ChatGPT Plugin for AI-powered podcast search. Powered by PodcastAPI.com and Cloudflare Pages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.2%
  • HTML 2.8%