Skip to content

Commit 760fe2f

Browse files
committed
add slack atd bindings for url verification and chat unfurl
Link unfurling requires usage of Slack's Events API. The first step in configuring it is url verification. Subsequently, we can start accepting event callback notifications, one of which is chat_unfurl.
1 parent 59458ee commit 760fe2f

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

lib/slack.atd

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
type 'v map_as_object <ocaml from="State"> = abstract
2+
13
type message_field = {
24
?title: string nullable;
35
value: string;
@@ -65,3 +67,53 @@ type post_message_res = {
6567
?channel: string nullable;
6668
?error: string nullable;
6769
}
70+
71+
type link_shared_link = {
72+
domain: string;
73+
url: string;
74+
}
75+
76+
type link_shared_event = {
77+
channel: string;
78+
is_bot_user_member: bool;
79+
user: string;
80+
message_ts: string;
81+
?thread_ts: string option;
82+
links: link_shared_link list;
83+
}
84+
85+
type event = [
86+
| Link_shared <json name="link_shared"> of link_shared_event
87+
] <ocaml repr="classic"> <json adapter.ocaml="Atdgen_runtime.Json_adapter.Type_field">
88+
89+
type event_callback_notification = {
90+
token: string;
91+
team_id: string;
92+
api_app_id: string;
93+
event: event;
94+
event_id: string;
95+
event_time: int;
96+
}
97+
98+
type url_verification_notification = {
99+
token: string;
100+
challenge: string;
101+
}
102+
103+
type event_notification = [
104+
| Event_callback <json name="event_callback"> of event_callback_notification
105+
| Url_verification <json name="url_verification"> of url_verification_notification
106+
] <ocaml repr="classic"> <json adapter.ocaml="Atdgen_runtime.Json_adapter.Type_field">
107+
108+
type unfurl = message_attachment
109+
110+
type chat_unfurl_req = {
111+
channel: string;
112+
ts: string;
113+
unfurls: unfurl map_as_object;
114+
}
115+
116+
type chat_unfurl_res = {
117+
ok: bool;
118+
?error: string option;
119+
}

0 commit comments

Comments
 (0)