![How to make AI News Summary Subscription Service](https://assets.community.aws/a/2gOu2ycP8eAgojihIwFjtejRBKi/Unti.webp)
How to make AI News Summary Subscription Service
Provides customized news to customers by summarizing the news using the antique model.
Hyunjoong Shin
Amazon Employee
Published May 13, 2024
So much news is being generated in real time. Users want to receive news that they are interested in quickly and only important information. Therefore, to address this, users click on the categories they want to subscribe to directly and receive newsletters summarized in AI for related news.
![Image preview](https://assets.community.aws/a/2gOu2ycP8eAgojihIwFjtejRBKi/Unti.webp)
1. In Streamlit, insert User Data, include email, category
2. Set up the Cron expression on EventBridge to run Lambda at a specific time.
3. When a certain time is triggered, DynamoDB gets information about users.
4. Use Bedrock to summarize the news information received from the external API.
5. We select and send only news that fits the category selected by the customer.
- The AWS CLI must be credentialed (in the current example, use AdministratorAccess permissions)
- You must create a table in DynamoDB with Email as the key value.
- The IAM role used for AWS lambda must include DynamoDB Full Access, Bedrock Full Access, and SES Full Access.
- Email entering DynamoDB must be SES credentialed.
- You can put your email address and category in the form below.
![](https://assets.community.aws/a/2gOu8TVUs8cdW8cn0YwmpxXD0MW/Past.webp)
- Create a file called NewsFront.py from Python IDE and enter the code below.
- Install the following and bot3 to put the email address in DynamoDB and enter the code below
- Code to put your email address and options on the table. Please enter your own table. (NewsFront.py)
- Add a code that checks for duplication before inserting an email.
- Generates the function from AWS Lambda function to the latest version of Python.
- In this case, the Lambda function must be created by attaching the IAM Role mentioned in the prerequisite. (DynamoDBFullAccess, BedrockFullAccess,SESFullAccess)
- After the AWS Lambda function is generated, modify the code as below: (Lambda function: Send_news)
- A code that receives the input of the prompt and outputs the result using clade-v2.
- Code that format documents to send to users in html format.
- Code that uses AWS SES to send an email to an account with SES credentials.
- Code that returns users' information (emails, categories) stored in DynamoDB.
- In the get_news function, data must be retrieved using the news API.
(Note: There is no news API service provided by Amazon, so this part needs to be set up personally.)
- Set the trigger using the cron expression.
- In the current example, the trigger is set to occur starting at 12:00 p.m. every day.
![](https://assets.community.aws/a/2gOuigQPowXnkjOl7u8jh9dG6CK/Past.webp)
![](https://assets.community.aws/a/2gOukFuIGOM3kVDc4FEgCWIHH9O/Past.webp)
- At a certain time, the news for the category selected by the user is summarized and emailed.
![](https://assets.community.aws/a/2gOunm9y05pwkL4fAzfNzx8swKY/Past.webp)
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.