-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat]: Slack Bot Added and .env file added
- Loading branch information
1 parent
d6524be
commit 7ec4861
Showing
9 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# Upwork SlackBot | ||
# Upwork SlackBot | ||
|
||
## TO-DO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import os | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
CONSUMER_KEY = os.environ['CONSUMER_KEY'] | ||
CONSUMER_SECRET = os.environ['CONSUMER_SECRET'] | ||
QUERY = os.environ['QUERY'] | ||
QUERY = os.environ['QUERY'] | ||
SLACK_BOT_TOKEN = os.environ['SLACK_BOT_TOKEN'] | ||
SLACK_APP_TOKEN = os.environ['SLACK_APP_TOKEN'] | ||
CHANNEL_ID = os.environ['CHANNEL_ID'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from slack_bot import Slackbot | ||
from upwork_bot import UpworkBot | ||
from config import ( | ||
QUERY, | ||
SLACK_APP_TOKEN,CHANNEL_ID) | ||
slack_bot = Slackbot(SLACK_APP_TOKEN,CHANNEL_ID) | ||
upwork_bot = UpworkBot(QUERY) | ||
|
||
html_data = upwork_bot.get_data() | ||
jobs_data = upwork_bot.parse_data(html_data) | ||
formatted_response = upwork_bot.format_data(jobs_data) | ||
slack_bot.send_update(formatted_response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from slack_bot.bot import Slackbot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from slack_bolt import App | ||
from slack.errors import SlackApiError | ||
from slack_bolt.adapter.socket_mode import SocketModeHandler | ||
|
||
|
||
|
||
|
||
class Slackbot: | ||
def __init__(self, slack_app_token,channel_id): | ||
""" | ||
""" | ||
self.app = App(token=slack_app_token) | ||
# ID of channel you want to post message to | ||
self.channel_id = channel_id | ||
def send_update(self,message_payload): | ||
""" | ||
""" | ||
try: | ||
# Call the conversations.list method using the WebClient | ||
result = self.app.client.chat_postMessage( | ||
channel=self.channel_id, | ||
text = message_payload, | ||
mrkdwn=True | ||
) | ||
except SlackApiError as e: | ||
print(f"Error: {e}") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from upwork_bot.bot import UpworkBot | ||
from upwork_bot.client import Client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.