-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathconnection-admin-approval.swadl.yaml
54 lines (54 loc) · 1.44 KB
/
connection-admin-approval.swadl.yaml
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
id: connection-admin-approval
variables:
# a user that is validating connection requests made to the bot
administrator: 13056700579841
activities:
- execute-script:
id: vars
on:
connection-requested: { }
script: |
variables.user = event.initiator.user.userId
- send-message:
id: form
to:
user-ids:
- ${variables.administrator}
content: |
<messageML>
<form id="form">
User ${event.initiator.user.displayName} would like to connect to the bot, accept or reject request?
<br/>
<button name="accept" type="action">Accept</button>
<button name="reject" type="action">Reject</button>
</form>
</messageML>
- accept-connection:
id: formReplyAccept
on:
form-replied:
form-id: form
if: ${form.action == 'accept'}
user-id: ${variables.user}
- send-message:
id: accepted
to:
user-ids:
- ${variables.administrator}
content: Connection accepted
- reject-connection:
id: formReplyReject
on:
one-of:
- form-replied:
form-id: form
- activity-completed:
activity-id: form
if: ${form.action == 'reject'}
user-id: ${variables.user}
- send-message:
id: rejected
to:
user-ids:
- ${variables.administrator}
content: Connection rejected