This repository hosts the 'UK Latest News' ChatGPT Plugin, a Next.js app designed to fetch and present the UK's latest news stories in ChatGPT.
You can install it via the ChatGPT Plugin Store, or read on to run it locally.
The first step to get this project up and running locally is to clone the repository:
git clone https://github.com/rossheat/uk-latest-news-chatgpt-plugin.git
cd uk-latest-news-chatgpt-plugin
Then, create a .env.local
file in the root directory of your project. Add the following line to the file:
SERVICE_ACCESS_TOKEN=your_token_here
Replace your_token_here
with an actual service access token (a random alphanumeric string). This SERVICE_ACCESS_TOKEN
is used by the application to verify the authenticity of incoming requests. If the token used in the request does not match the one specified in the .env.local
file, the request will not be processed and a "401 Unauthorized" error will be returned.
Then, install the dependencies:
npm install
# or
yarn
# or
pnpm install
Now you can run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
Open http://localhost:3000 with your browser to see the result.
This project exposes the "UK Latest News" API, which offers two main operations:
GET /api/v1/stories
: Fetches the latest news stories from multiple UK news sources and returns an array of Open Graph-compatible data for each story.GET /api/v1/story
: Given a URL, extracts the story content from the webpage.
Detailed information about the API's operations, responses, and potential errors is available in the /public/.well-known/openapi.yaml
file.
To learn more about creating ChatGPT plugins, take a look at the following resources:
- Chat Plugins Docs - learn how to make a plugin for ChatGPT.
- Next.js Docs - learn about Next.js features and API.
The easiest way to deploy the plugin is to use the Vercel Platform.
Check out the Next.js deployment documentation for more details.