Skip to content

Commit

Permalink
updated deprecated API call and updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
n00py committed Jan 28, 2020
1 parent 2d42c51 commit 2cbdc2b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ Setup
For this to work you need:
- A Slack Workspace
- [Register an app](https://api.slack.com/apps) with the following permissions:
- **channels:read**
- **channels:history**
- **channels:write**
- **files:write:user**
- **files:read**
Bot:
- **channels:history**
- **channels:read**
- **chat:write**
- **users:read**
User:
- **channels:history**
- **channels:write**
- **files:read:**
- **files:write**

- Create a bot

Expand Down
4 changes: 2 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def registration_monitor(bearer, registration, token, timestamp): # Checks for
headers = {'Authorization': 'Bearer ' + bearer}
data = {"channel": registration,
"token": token, "oldest": timestamp}
r = requests.post('https://slack.com/api/channels.history', headers=headers, data=data)
r = requests.post('https://slack.com/api/conversations.history', headers=headers, data=data)
result = json.loads(r.text)
try:
if result["error"]: # Hit rate limit
Expand Down Expand Up @@ -261,7 +261,7 @@ def response_check(bearer, responses, token, timestamp):
data = {"channel": responses,
"token": token, "oldest": timestamp, }
# This request gets the latest messages from the channel
r = requests.post('https://slack.com/api/channels.history', headers=headers, data=data)
r = requests.post('https://slack.com/api/conversations.history', headers=headers, data=data)
# Parse the response
try:
result = json.loads(r.text)
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
if not os.path.exists("output"):
os.mkdir("output")

print("Ensure your Slack app has these permissions before you continue:"
"\nchannels:history\nchannels:read\nchannels:write \nfiles:write:user\nfiles:read\n"
"You must also create a Slack bot")
print("First you must also create a Slack bot.\n"
"Ensure your Slack app has these permissions before you continue:\nBot:\n"
"\nchannels:history\nchannels:read\nchannels:write \nchat:write:\nusers:read\n"
"User:\nchannels:history\nchannels:write\nfiles:read\nfiles:write")
token = input("Enter the OAuth Access Token: ")
bearer = input("Enter the Bot User OAuth Access Token: ")

Expand Down

0 comments on commit 2cbdc2b

Please sign in to comment.