Skip to content

Commit 6ba417b

Browse files
committed
Minor fix on API_Skack_Integration (method that parsed the data)
1 parent 10c2003 commit 6ba417b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

osbot/api/API_Slack_Interaction.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def process_dialog_suggestion(self,data, field_name):
107107
def process_interactive_action(self,data):
108108
text = 'interactive action received'
109109
attachments = []
110+
import requests
110111
requests.post(data['response_url'],
111112
headers={'Content-Type': 'application/json'},
112113
data=json.dumps({'text': text, 'attachments': attachments}))
@@ -127,7 +128,7 @@ def decode_body_form_encoded(self, body):
127128
def handle_request(self, event):
128129
try:
129130
body = event.get('body')
130-
raw_json = urllib.parse.unquote(body).split('=').pop() # convert the data back to json (need to pick the 2nd parameter
131+
raw_json = urllib.parse.unquote(body).split('payload=').pop() # convert the data back to json (need to pick the 2nd parameter
131132
data = json.loads(raw_json) # load into Python object
132133
log_to_elk('osbot.lambdas.slack_callback_handle_request', data=data, index='slack_interaction', category='API_Slack_Interaction')
133134
return Lambda('osbot_jira.lambdas.slack_actions').invoke(data)

osbot/api/GS_Bot_Commands.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66

77
class GS_Bot_Commands: # move to separate class
88

9-
gsbot_version = 'v0.65 (OSBot)'
9+
gsbot_version = 'v0.66 (OSBot)'
1010

1111
@staticmethod
1212
def hello(slack_event, params=None):
1313
user = slack_event.get('user')
1414
return 'Hello <@{0}>, how can I help you?'.format(user), []
1515

16+
@staticmethod
17+
def stop(slack_event, params=None):
18+
return "I'm sorry Dave, I'm afraid I can't do that", []
19+
1620
@staticmethod
1721
def help(slack_event, params=None):
1822
commands = [func for func in dir(GS_Bot_Commands) if callable(getattr(GS_Bot_Commands, func)) and not func.startswith("__")]

0 commit comments

Comments
 (0)