-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
2060 lines (1817 loc) · 74.1 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import sys
import logging
import os
import time
import json
import requests
import datetime
from slack_bolt import App
from slack_bolt.adapter.flask import SlackRequestHandler
from flask import Flask, request
from azure.cosmos import exceptions, CosmosClient, PartitionKey
from questions_payloads import *
###############################################################################
# Initializing
###############################################################################
# initializing survey_dict
survey_dict = {}
psych_dict = {}
# enable logging
logging.basicConfig(level=logging.DEBUG)
# Initialize bolt
bolt_app = App(
token=os.environ.get("SLACK_BOT_TOKEN"),
signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
)
# Initialize Flask app and bolt handler
app = Flask(__name__)
handler = SlackRequestHandler(bolt_app)
# redirect request to bolt
@app.route("/slack/events", methods=["POST"])
def slack_events():
return handler.handle(request)
## Start platform related code
# Create a logger for the 'azure' SDK and configure a console output
azureLogger = logging.getLogger('azure')
azureLogger.setLevel(logging.DEBUG)
azureLogger.addHandler(logging.StreamHandler(stream=sys.stdout))
# Initialize the Cosmos client
cosmos = CosmosClient(
url=os.environ.get("AZURE_COSMOS_ENDPOINT"),
credential=os.environ.get("AZURE_COSMOS_MASTER_KEY"),
logging_enable=True
)
# Create a database
database_name = 'bot-storage'
database = cosmos.create_database_if_not_exists(id=database_name)
# Create a container
# Using a good partition key improves the performance of database operations.
msgDB_name = 'message-storage'
msgDB = database.create_container_if_not_exists(
id=msgDB_name,
partition_key=PartitionKey(path="/user"),
offer_throughput=400
)
survey_containter = database.get_container_client("survey-storage")
#Create Brainstorming container in the Azure database during the first start up.
#This database will be used for the brainstorm listener functionality and will be activated
#by the /startBrainstorming command
brainDB_name = 'brainstorm-storage'
brainDB = database.create_container_if_not_exists(
id=brainDB_name,
partition_key=PartitionKey(path="/user"),
offer_throughput=400
)
# Create container for statistics.
statDB_name = 'statistics-storage'
statDB = database.create_container_if_not_exists(
id=statDB_name,
partition_key=PartitionKey(path="/info_type")
)
#Create Psych container
psychDB_name = 'psych-storage'
psychDB = database.create_container_if_not_exists(
id=psychDB_name,
partition_key=PartitionKey(path="/user"),
offer_throughput=400
)
# Insert the initial item for workspace-wide statistics only if it doesn't exist:
try:
statDB.create_item({
'id': '1',
'total_workspace_messages': 0,
'total_users': 0,
'average_msg_time': 0,
'sum_msg_ts': 0,
'info_type': 'Workspace-wide stats'
}
)
except exceptions.CosmosHttpResponseError:
print("Initial item for workspace-wide statistics already exists, continuing:")
try:
statDB.create_item({
'id': '2',
'Feedback-Change': 0,
"Feedback-Keep": 0,
'Psych-Completed': 0,
'info_type': 'Survey stats'
}
)
except exceptions.CosmosHttpResponseError:
print("Initial item for workspace-wide statistics already exists, continuing:")
# Insert the initial items for individual user statistics.
user_result = bolt_app.client.users_list()
for user in user_result["members"]:
try:
statDB.create_item({
'id': user["id"],
'total_user_messages': 0,
'total_sent_mentions': 0,
'total_received_mentions': 0,
'total_long_user_messages': 0,
'total_short_user_messages': 0,
'psychScore': 0,
'previous_messages': 0,
'most_messages': 0,
'sentiment_count': 0,
'sentiment_score': 0,
'group_leader': 0,
'info_type': 'User stats'
}
)
except exceptions.CosmosHttpResponseError:
print("Initial item for user:", user["id"], "statistics already exists, continuing:")
# Insert the initial items for individual channel statistics.
channel_result = bolt_app.client.conversations_list()
for channel in channel_result["channels"]:
try:
statDB.create_item({
'id': channel["id"],
'total_channel_messages': 0,
'total_long_channel_messages': 0,
'total_short_channel_messages': 0,
'info_type': 'Channel stats'
}
)
except exceptions.CosmosHttpResponseError:
print("Initial item for channel:", channel["id"], "statistics already exists, continuing:")
## The database usage in the rest part may need to be changed on a different platform
# API setup for sentiment analysis
subscription_key=os.environ.get("TEXT_ANALYTICS_KEY")
endpoint=os.environ.get("TEXT_ANALYTICS_ENDPOINT")
language_api_url = endpoint + "/text/analytics/v3.0/languages"
sentiment_url = endpoint + "/text/analytics/v3.0/sentiment"
## End platform related code
#Global Variables
#Brainstorming Global Variables
#BrainstormOn indicated that the listener is active (if 1) and off (if 0) which is used in
#the middleware to determine if the brainstorming container should be accepting messages
#from the chat
brainstormOn = 0
#brain_weekly is a value from the dashboard which indicates if the team wants a reminder
#to review their brainstorming session (if 1) or not (if 0)
brain_weekly = 0
#Psychological Safety Survey Global Variables
#This value will be used in determinging how often the team wants a reminder about the survey.
#It can be set to either 1, 2, or 3 for a reminder every 1, 2, or 3 weeks respectivley
weeklySurveyValue = 0
#Weekly Id is the Id of the scheduled reminder for the team that will be used when scheduling and
#deleting the reminder according to how the team uses the survey
weekly_id = ""
#Channel is logged when a user joins the channel in order to allow the scheduling of the message
#in the channel for fields that do not have an associated channel (like from the dashboard for example)
channel = ""
#This value holds the number of people that have completed the survey in a given interval and is reset to 0
#once every member has completed the survey
weeklyCompleted = 0
#psychBad is a switch (0 or 1) that is used when determining if any member has identified that the team enviroment
#feels psychologically unsafe. If they have psychBad will be set to 1 and will be used in sending a message in the team
psychBad = 0
group_leader_id = 'None'
group_leader_name = 'None'
###############################################################################
# Middleware
###############################################################################
# If this part goes slow the server may send the message mutiple times
# Maybe consider ack in one of these functions?
# Log and print request
@bolt_app.middleware
def log_request(logger, body, next):
logger.debug(body)
return next()
# Log all messages
@bolt_app.middleware
def log_message(client, payload, next):
global brainstormOn
if ("type" in payload and payload["type"]=="message"):
text = payload["text"]
# get mention from message text
mentions = []
for i in range(len(text)):
if text[i] == "<":
if text[i+1] == "@":
j = i + 1
while text[j] != ">":
j = j + 1
mentions.append(text[i+2:j])
# sentiment analysis
# get language
lang_documents = {"documents": [{
"id": payload["ts"],
"text": payload["text"]}
]}
headers = {"Ocp-Apim-Subscription-Key": subscription_key}
lang_response = requests.post(language_api_url, headers=headers, json=lang_documents)
# wait for response
time.sleep(.050)
languages = lang_response.json()
print(languages["documents"])
senti_documents = {"documents": [{
"id": payload["ts"],
"language": languages["documents"][0]["detectedLanguage"]["iso6391Name"],
"text": payload["text"]}
]}
response = requests.post(sentiment_url, headers=headers, json=senti_documents)
time.sleep(.050)
sentiments = response.json()
if (sentiments != None):
# In case the resopnse maybe empty or error
try:
# Positive/negative score range:[0,1], sentiment range:[-1,1]. See Azure documents for details
sentiment = sentiments["documents"][0]["confidenceScores"]["positive"] - sentiments["documents"][0]["confidenceScores"]["negative"]
except:
sentiment = 0
print("Sentiment error")
else:
sentiment = 0
# id is required
msg = {
'id' : payload["ts"],
'channel': payload["channel"],
'user': payload["user"],
'message': payload["text"],
'mention': mentions,
'sentiment': sentiment
}
msgDB.upsert_item(msg)
# bad sentiment alert
if (sentiment < -0.75):
client.chat_postMessage(channel=payload["channel"], text=f"Hey Everyone! Please speak kindly to one another, we want discussion and disagreement not hostility!")
# Update workspace-wide statistics
# Increment the count of total messages in the workspace
prev_workspace_stats = statDB.read_item(item="1", partition_key="Workspace-wide stats")
prev_workspace_stats['total_workspace_messages'] += 1
# Update the average time messages are sent. Note that the time calculated is in UTC.
msg_ts = float(payload["ts"])
date = datetime.datetime.fromtimestamp(msg_ts)
msg_ts_time = date.time()
msg_ts_secs = int(msg_ts_time.hour) * 3600 + int(msg_ts_time.minute) * 60 + int(msg_ts_time.second)
prev_workspace_stats['sum_msg_ts'] += msg_ts_secs
new_avg = int(prev_workspace_stats['sum_msg_ts']) / int(prev_workspace_stats["total_workspace_messages"])
prev_workspace_stats['average_msg_time'] = str(datetime.timedelta(seconds=new_avg))
statDB.replace_item("1", prev_workspace_stats)
# Update individual user statistics
# Update total messages sent
prev_user_stats = statDB.read_item(item=payload["user"], partition_key="User stats")
prev_user_stats['total_user_messages'] += 1
# Update the message counts based on length
if len(payload["text"]) > 40:
prev_user_stats['total_long_user_messages'] += 1
else:
prev_user_stats['total_short_user_messages'] += 1
# Per user sentiment
count = prev_user_stats['sentiment_count']
prev_user_stats['sentiment_score'] = (prev_user_stats['sentiment_score']*count + sentiment)/(count+1)
prev_user_stats['sentiment_count'] = count + 1
# Check and record mentions
for user in user_result["members"]:
if user in mentions:
other_user_stats = statDB.read_item(item=user, partition_key="User stats")
other_user_stats['total_received_mentions'] += 1
statDB.replace_item(user, other_user_stats)
prev_user_stats['total_sent_mentions'] += 1
# update database
statDB.replace_item(payload["user"], prev_user_stats)
# Update individual channel statistics
# Total messages sent and message length
try:
prev_channel_stats = statDB.read_item(item=payload["channel"], partition_key="Channel stats")
prev_channel_stats['total_channel_messages'] += 1
if len(payload["text"]) > 40:
prev_channel_stats['total_long_channel_messages'] += 1
else:
prev_channel_stats['total_short_channel_messages'] += 1
statDB.replace_item(payload["channel"], prev_channel_stats)
except exceptions.CosmosHttpResponseError:
print("Channel:", payload["channel"], "not found, continuing:")
# Brainstorming Listener that fills entries into the brainstorming container when the listener
# is active. This container will allow all of the ideas put into the chat in the time period
# to be output by Amy into the chat once the listener is turned off
if (brainstormOn == 1):
msgBrain = {
'id' : payload["ts"],
'channel': payload["channel"],
'user': payload["user"],
'message': payload["text"],
'mention': None
}
brainDB.create_item(msgBrain)
return next()
###############################################################################
# Message Handler
###############################################################################
# Listens to incoming messages that contain "hello"
@bolt_app.message("hello")
def message_hello(ack, message, say):
# say() sends a message to the channel where the event was triggered
ack()
say(
blocks=[
{
"type": "section",
"text": {"type": "mrkdwn", "text": f"Hey there <@{message['user']}>!"},
"accessory": {
"type": "button",
"text": {"type": "plain_text", "text": "Click Me"},
"action_id": "button_click"
}
}
],
text=f"Hey there <@{message['user']}>!"
)
#returns true if user is an introvert, false otherwise
def is_introvert(user):
if user in survey_dict:
temp = survey_dict[user]
e = 20 + temp[0] - temp[5] + temp[11] - temp[15] + temp[20] - temp[25] + temp[30] - temp[35] + temp[40] - temp[45]
if e < 13:
return True
else:
return False
else:
return False
#returns true if user is an extrovert, false otherwise
def is_extrovert(user):
if user in survey_dict:
temp = survey_dict[user]
e = 20 + temp[0] - temp[5] + temp[11] - temp[15] + temp[20] - temp[25] + temp[30] - temp[35] + temp[40] - temp[45]
if e > 27:
return True
else:
return False
else:
return False
def most_messages_(user_results, average):
result = []
introvert = []
extrovert = []
sentiment = []
most_messages = 0
for user in user_results:
if (not user['is_bot']) and (user['real_name'] != 'Slackbot'):
user_stats = statDB.read_item(item=user['id'], partition_key="User stats")
total = user_stats['total_user_messages'] - user_stats['previous_messages']
if total > most_messages:
most_messages = total
user_id = user['id']
real_name = user['real_name']
user_stats['previous_messages'] = user_stats['total_user_messages']
if (total < average - 15) and (is_introvert(user['id'])):
introvert.append(user['id'])
elif (total > average + 20) and (is_extrovert(user['id'])):
extrovert.append(user['id'])
# sentiment alert
if (user_stats['sentiment_score'] < -0.25):
sentiment.append(user['id'])
user_stats['sentiment_count'] = 0
statDB.replace_item(user['id'], user_stats)
return [user_id, real_name, introvert, extrovert, sentiment]
# handle all messages
@bolt_app.message("")
def message_rest(ack, client, message):
ack()
global group_leader_name
stats = statDB.read_item(item = "1", partition_key = "Workspace-wide stats")
total_messages = stats.get("total_workspace_messages")
user_result = client.users_list()
user_results = user_result['members']
number_bots = 0
for user in user_results:
if user['is_bot']:
number_bots += 1
average = total_messages/(len(user_results) - number_bots)
if total_messages % 100 == 0:
most_messages_array = most_messages_(user_results, average)
result = most_messages_array[0]
real_name = most_messages_array[1]
introvert = most_messages_array[2]
extrovert = most_messages_array[3]
sentiment = most_messages_array[4]
for id in introvert:
client.chat_postMessage(channel=id, text=f"Hey there <@{user['id']}>, I have noticed you haven't been contributing a lot recently. We would love to hear your ideas!")
for id_ in extrovert:
client.chat_postMessage(channel=id_, text=f"Hey there <@{user['id']}>, I have noticed you have been sending a lot of messages recently. Just wanted to check in and make sure that everyone has had the opportunity to share their ideas!")
for id__ in sentiment:
client.chat_postEphemeral(channel = message['channel'], user = id__, text = "Hey there <@{user['id']}>, I have noticed you aren't communicating in a friendly way. Please be kind to your teammates!")
leader = statDB.read_item(item=most_messages_array[0], partition_key="User stats" )
leader['most_messages'] = leader['most_messages'] + 1
total_checks = stats['total_workspace_messages']/100
if leader['most_messages']/total_checks > 0.5:
leader['group_leader'] = 1
group_leader_name = most_messages_array[1]
group_leader_id = most_messages_array[0]
statDB.replace_item(most_messages_array[0], leader)
###############################################################################
# Action Handler
###############################################################################
# handler for a radio button being selected
@bolt_app.action("this_is_an_action_id")
def action_button_click(ack, body, client, say):
# Acknowledge the action
ack()
user = body['user']['id']
form_json = json.dumps(body)
form_json = form_json[-150:]
question_number = ""
answer = ""
result = form_json.find('value')
form_json = form_json[result+10:]
for x in range(len(form_json)):
if form_json[x] == '_':
answer = form_json[x+1]
break
else:
question_number += form_json[x]
answer = int(answer)
question_number = int(question_number)
temp = survey_dict[user]
temp[question_number-1] = answer
survey_dict[user] = temp
#This handler handles the radio buttons in the view payload after /psych_survey is called
@bolt_app.action("psych_radio_id")
def action_button_click(ack, body, say):
ack()
global psychBad
#Take the body of the response from the buttons selected and turn it into a Json for simpiler
#parsing. Find the label "actions" which contains information about the button pressed including
#the value we associated with it (defined in the view above).
form_json = json.dumps(body)
form_json = form_json[500:]
actions_index = form_json.find('actions')
form_json = form_json[actions_index:]
value_index = form_json.find('value')
value = form_json[value_index+9]
user = body['user']['id']
#Reference the previous score of the user and update it according to their selected value
psychScore = statDB.read_item(item=user, partition_key="User stats")
psychScore['psychScore'] += int(value)
#If the button selected is for the last question in the survey average the score of the user
#and see if it is below 3 (meaning they overall identified an unsafe team enviroment). If they
#have, set the value for psychBad to 1 so that the team will be informed that someone feels this
#way. Otherwise leave the score as is and reset the value of the psychScore to 0 for future runs
#of the survey
if (form_json[value_index+11] == "7"):
psychScore['psychScore'] /= 7
if (psychScore['psychScore'] < 3):
psychBad = 1
psychScore['psychScore'] = 0
#Replace the current value in the database with the new one for the next button
#or for future iterations
statDB.replace_item(user, psychScore)
#After 30 minutes the EndBrainstorming button will appear and prompt the team to end the Listener
#This buttom will act the exaxt same as if they typed /endBrainstorming but due to an inability to
#stop the listener automatically after 30 minutes the users must do so manually
@bolt_app.action("EndBrainstorming")
def action_button_click(ack, body, say):
# Acknowledge the action
ack()
#Use the global scope for the brainstorming variables listed above
global brainstormOn
global brain_weekly
#Check if brainstorm bit is already 0 to prevent spamming of the button
if (brainstormOn == 1):
brainstormOn = 0
say('Here are all of the ideas the group came up with: ')
#Iterate through all of the ideas the group proposed from the brainstorming container
#in the database. Once processed delete the item from the container so it will not appear
#in the next use of the listener
item_list = list(brainDB.read_all_items())
msg = ""
for i in item_list:
msg += "• " + i.get("message") + "\n"
brainDB.delete_item(item = i.get("id"), partition_key = i.get("user"))
say(msg)
#Propose a couple websites to the channel that allow the group to mock up ideas they came up with
say("Need a mockup of one of the ideas? Try using <https://www.sketchup.com/plans-and-pricing/sketchup-free|Google Sketch up> or <https://www.figma.com/|Figma>")
#If the group decided they want a reminder to review their brainstorming session on the
#dashboard then let them know the reminder has been set and will appear in a week
if (brain_weekly == 1):
say("Also a reminder has been set for next week to look back on the brainstorming process")
else:
say("Brainstorming has already ended")
@bolt_app.action("button_click")
def action_button_click(ack, body, say):
# Acknowledge the action
ack()
say(f"<@{body['user']['id']}> clicked the button")
@bolt_app.action("take_survey")
def action_button_click(ack, body, client):
# Acknowledge the action
user = body['user']['id']
survey_dict[user] = [0 for x in range(50)]
ack()
client.views_open(
# Pass a valid trigger_id within 3 seconds of receiving it
trigger_id=body["trigger_id"],
# View payload
view=question1_payload
)
@bolt_app.action("back")
def action_button_click(ack, body, client):
ack()
form_json = json.dumps(body)
result = form_json.find('Question')
form_json = form_json[result+8:]
question_number = ""
for char in form_json:
if char == '"':
break
else:
question_number += char
question_number = int(question_number)
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question_list[question_number-2]
)
# TODO: Use only 1 next button function like above
@bolt_app.action("question1_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question2_payload
)
@bolt_app.action("question2_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question3_payload
)
@bolt_app.action("question3_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question4_payload
)
@bolt_app.action("question4_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question5_payload
)
@bolt_app.action("question5_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question6_payload
)
@bolt_app.action("question6_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question7_payload
)
@bolt_app.action("question7_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question8_payload
)
@bolt_app.action("question8_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question9_payload
)
@bolt_app.action("question9_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question10_payload
)
@bolt_app.action("question10_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question11_payload
)
@bolt_app.action("question11_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question12_payload
)
@bolt_app.action("question12_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question13_payload
)
@bolt_app.action("question13_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question14_payload
)
@bolt_app.action("question14_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question15_payload
)
@bolt_app.action("question15_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question16_payload
)
@bolt_app.action("question16_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question17_payload
)
@bolt_app.action("question17_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question18_payload
)
@bolt_app.action("question18_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question19_payload
)
@bolt_app.action("question19_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question20_payload
)
@bolt_app.action("question20_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question21_payload
)
@bolt_app.action("question21_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question22_payload
)
@bolt_app.action("question22_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question23_payload
)
@bolt_app.action("question23_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question24_payload
)
@bolt_app.action("question24_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question25_payload
)
@bolt_app.action("question25_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question26_payload
)
@bolt_app.action("question26_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question27_payload
)
@bolt_app.action("question27_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question28_payload
)
@bolt_app.action("question28_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question29_payload
)
@bolt_app.action("question29_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question30_payload
)
@bolt_app.action("question30_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question31_payload
)
@bolt_app.action("question31_next")
def action_button_click(ack, body, client):
# Acknowledge the action
ack()
client.views_update(
view_id=body["view"]["id"],
# Pass a valid trigger_id within 3 seconds of receiving it
hash=body["view"]["hash"],
# View payload
view=question32_payload