A GPT-powered daily newsletter bot, written in Rust

Overview

AI Newsie

1. Introduction

Meet AI Newsie - your personalized GPT-powered bot that delivers daily newsletters tailored to your interests. The bot is powered by the NYT API, GPT-3-Turbo, Sendgrid API, and it is built to run on AWS Lambda. It even transcribes your newsletter to a speech recording so you can listen to it on the go.

Newsletter Part Screenshot Recording Screenshot

2. Configuring and Deploying AI Newsie

To use the bot, one would need the following:

  1. A Sendgrid API key - for sending emails
  2. A NYT API key - For grabbing news stories
  3. An OpenAI API Key - For processing and summarizing the news stories
  4. An AWS account:
  • For access to AWS Polly (text-to-speech) and
  • AWS Lambda (deploying the bot)

1. Setting up Sendgrid

  1. Sign up for Sendgrid and setup a sender identity and take note of your sendgrid sender email address. The most straightforward verfication route is Single Sender Verification.
  2. After setting up a sender identity, create an API key by navigating to Settings -> API Keys -> Create API Key. Take note of this API key (not to be confused with the API Key ID) as it is hidden soon after generation.

2. Setting up NYT API

  1. Create a NYT developer account here.
  2. Navigate to the My Apps page by clicking the dropdown at the upper left corner of the page and selecting "Apps".
  3. Create an API key in the "API Keys" section by clicking "Add Key". Copy the API Key under the "Key" header.
  4. Under the "APIs" section, ensure "Article Search API" is enabled.
  5. Below that, hit the "Save" Button.

3. Setting up OpenAI API

  1. Create an account here.
  2. Navigate to the API Keys page by clicking your account in the top left corner of the page and selecting "View API Keys".
  3. Create a new API key by clicking the "Create new secret key" button. Take note of the newly generated key.

4. Setting up AWS

  1. If you haven't already, setup an AWS account here.
  2. Navigate to the AWS Lambda service page by searching "Lambda" in the search bar at the top of the page.
  3. Click "Create Function" and select the "Author from scratch" option.
  4. Create a name for the new function, e.g. "NewsBot".
  5. For the "Runtime" section, select "Provide your own bootstrap on Amazon Linux 2", and under "Archictecture", select "arm64".
  6. Under the "Change Default Execution Role" section, make sure "Create a new role with basic Lambda permissions" is selected.
  7. Click "Create Function".
  8. Add AWS Polly permissions for the bot by navigating to the "Configurations" section -> clicking "Permissions", then clicking the link under Role Name in the "Execution Role" header.
  9. In the "Permissions" tab, click the "Add Permissions" button, then select "Attach Policy".
  10. Search for and select "AmazonPollyReadOnlyAccess" in the permissions search bar, then click "Add Permissions".
  11. Back to the Lambda Functions page, under the "Configuration" tab, select "Environment Variables".
  12. Configure the environment variables as follows, by clicking the "Edit" button: AWS Lambda Function Environment Variables
  13. Click the "Save" button after setting environment variables.
  14. Under the "General Configuration" menu, click "Edit" and change the timeout to "2min 0sec", and save.
  15. Grab a pre-built bootstrap from here, and downloading bootstrap.zip from the latest version.
  16. Back to your AWS Lambda function, in the "Code" section, scroll down and click "Upload From" -> ".zip file".
  17. Once the zip has been uploaded, test your function works by navigating to the "Test" tab and clicking the "Test" button. The function should send your AI-generated email to your desired destination, via your sendgrid sender email.
  18. Check the Log Output to confirm the bot ran as expected.
  19. Finally, you can schedule the bot to run daily by navigating to the "Triggers" section of the "Configuration" tab and clicking "Add Trigger".
  20. Then, select EventBridge, then "Create a new rule" and configuring "Rule Name" as "Daily_Newsletter", "Rule Description" as "Run the newsbot daily", and "Schedule Expression" as "rate(1 day)", then click "Add". Seting a trigger
You might also like...
My personal telegram bot in rust

My personal telegram bot in rust Setting up your environment Download Rust.

My bot Roseline for AGTH hooks and VN related stuff

Roseline Web interface My IRC Bot to store AGTH hooks. Commands ping - Obviously send you back pong. vn title - Search VN by title. hook title - G

A lightning fast version of tmux-fingers written in Rust, copy/pasting tmux like vimium/vimperator
A lightning fast version of tmux-fingers written in Rust, copy/pasting tmux like vimium/vimperator

tmux-thumbs A lightning fast version of tmux-fingers written in Rust for copy pasting with vimium/vimperator like hints. Usage Press ( prefix + Space

A command-line tool collection to assist development written in RUST

dtool dtool is a command-line tool collection to assist development Table of Contents Description Usage Tips Installation Description Now dtool suppor

Simple ray tracer written in Rust
Simple ray tracer written in Rust

Simple ray tracer written in Rust from scratch I've just finished my first semester at the Faculty of Applied Mathematics and Computer Science at the

BSV stdlib written in Rust and runs in WASM environments

BSV.WASM A Rust/WASM Library to interact with Bitcoin SV Installation NodeJS: npm i bsv-wasm --save Web: npm i bsv-wasm-web --save Rust: https://crate

Basically a KrabsETW rip-off written in Rust

FerrisETW 🦀 Basically a KrabsETW rip-off written in Rust, hence the name Ferris 🦀 All credits go to the team at Microsoft who develop KrabsEtw, with

A wasm interpreter written by rust

A wasm interpreter written by rust

Rustymind is a driver and parser for NeuroSky MindWave EEG headset written in pure Rust.
Rustymind is a driver and parser for NeuroSky MindWave EEG headset written in pure Rust.

Rustymind is a driver and parser for NeuroSky MindWave EEG headset written in pure Rust. You can use it to connect, interact, and plot real time data from the headset.

Releases(v0.1.0)
Owner
null
A git prepare-commit-msg hook for authoring commit messages with GPT-3.

gptcommit A git prepare-commit-msg hook for authoring commit messages with GPT-3. With this tool, you can easily generate clear, comprehensive and des

Roger Zurawicki 3 Jan 19, 2023
Extensions for x64dbg written in Rust: Telescope and Unicorn powered disassembly

This is the library that extends x64dbg with new features: Telescope. It's basically recursive dereferencerer of memory view which looks at the pointe

null 18 Sep 11, 2022
Byte is a blazingly fast🚀 Discord Bot with a user-friendly design using twilight written in rust🦀.

Byte Byte is a blazingly fast?? Discord Bot with a user-friendly design using twilight written in rust??. How To Run There is a public version of the

TakoTheDev 3 Nov 15, 2023
TaurApp is a WhatsApp desktop client powered by Tauri and Rust.

TaurApp TaurApp is a WhatsApp desktop client powered by Tauri and Rust. TaurApp is an experimental client and is initially created to test out Tauri i

Eray Erdin (&mut self) 22 Mar 19, 2023
A 3dprinter/cnc firmware framework powered by rust embassy

Printhor: The highly reliable but not necessarily functional 3D printer firmware If you are using this product or like the project, please ★ this repo

Carlos Barrales 26 Nov 15, 2023
Fox Ear is a Linux process behavior trace tool powered by eBPF

Fox Ear Fox Ear is a Linux process behavior trace tool powered by eBPF. Banner image by Birger Strahl on Unsplash. Features Log process and its subpro

Rui Li 77 Dec 5, 2022
An asynchronous IO utilities crate powered by tokio.

An asynchronous IO utilities crate powered by tokio.

Harry 2 Aug 18, 2022
Functional testing framework for AVR binaries, powered by simavr.

Functional testing framework for AVR binaries, powered by simavr. tl;dr get your microcontroller's firmware black-box-tested in seconds!

Patryk Wychowaniec 14 Nov 16, 2022
Web-wrapped Supabase desktop app for macOS, Windows & Linux powered by Tauri

Supabase Desktop App What is it? It's a cross-platform web-wrapped Supabase desktop app powered by Tauri. You can install it on your macOS, Windows (u

Abiel Zulio M 12 Jan 25, 2023
A modular and blazing fast runtime security framework for the IoT, powered by eBPF.

Pulsar is a security tool for monitoring the activity of Linux devices at runtime, powered by eBPF. The Pulsar core modules use eBPF probes to collect

Exein.io 319 Jul 8, 2023