SlackNewsBot is a Python script that fetches the top news headlines from Israel using NewsAPI and posts them to a specified Slack channel.
- Python 3.x
requests
libraryslack_sdk
library
- Clone this repository or download the files.
- Install the required Python libraries:
pip install -r requirements.txt
- Create a new Slack app at Slack API.
- Add permissions to the app:
chat:write
. - Install the app to your workspace and note the OAuth token (begins with
xoxb-
). - Find the ID of the Slack channel where you want to post the news.
- Sign up at NewsAPI and get your API key.
- Navigate to the
config.py
file. - Replace
YOUR_NEWSAPI_KEY
,YOUR_SLACK_BOT_TOKEN
, andYOUR_SLACK_CHANNEL_ID
with your actual NewsAPI key, Slack bot token, and Slack channel ID, respectively.
To run the application, execute the following command in the terminal:
python main.py
The script will fetch the latest news from Israel and post it to the specified Slack channel.