11import type {
22 Block , // TODO: these will be combined into one in a new types release
3+ EntityMetadata ,
34 KnownBlock ,
45 LinkUnfurls ,
56 MessageAttachment ,
@@ -104,6 +105,19 @@ export interface BroadcastedThreadReply extends ThreadTS {
104105// or not broadcasted. Broadcasted replies are necessarily threaded, so `thread_ts` becomes required.
105106type ReplyInThread = WithinThreadReply | BroadcastedThreadReply ;
106107
108+ export interface ChatPostMessageMetadata {
109+ /**
110+ * @description Object representing message metadata, entity and/or event data to attach to a Slack message.
111+ * Provide 'entities' to set work object entity metadata.
112+ * Provide 'event_type' and 'event_payload' to set event metadata.
113+ */
114+ metadata ?: Partial < MessageMetadata > & {
115+ /**
116+ * @description An array of work object entities.
117+ */
118+ entities ?: EntityMetadata [ ] ;
119+ } ;
120+ }
107121export interface Metadata {
108122 /** @description Object representing message metadata, which will be made accessible to any user or app. */
109123 metadata ?: MessageMetadata ;
@@ -191,7 +205,7 @@ export type ChatPostMessageArguments = TokenOverridable &
191205 Authorship &
192206 Parse &
193207 LinkNames &
194- Metadata &
208+ ChatPostMessageMetadata &
195209 Unfurls & {
196210 /** @description Disable Slack markup parsing by setting to `false`. Enabled by default. */
197211 mrkdwn ?: boolean ;
@@ -256,13 +270,8 @@ export interface SourceAndUnfurlID {
256270type UnfurlTarget = ChannelAndTS | SourceAndUnfurlID ;
257271
258272// https://docs.slack.dev/reference/methods/chat.unfurl
259- export type ChatUnfurlArguments = {
260- /**
261- * @description URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl
262- * blocks or message attachments.
263- */
264- unfurls : LinkUnfurls ;
265- } & UnfurlTarget &
273+ export type ChatUnfurlArguments = ( ChatUnfurlUnfurls | ChatUnfurlMetadata ) &
274+ UnfurlTarget &
266275 TokenOverridable & {
267276 /**
268277 * @description Provide a simply-formatted string to send as an ephemeral message to the user as invitation to
@@ -286,6 +295,29 @@ export type ChatUnfurlArguments = {
286295 user_auth_blocks ?: ( KnownBlock | Block ) [ ] ;
287296 } ;
288297
298+ /**
299+ * @description The `unfurls` param of the `chat.unfurl` API.
300+ */
301+ interface ChatUnfurlUnfurls {
302+ /**
303+ * @description Object with keys set to URLs featured in the message, pointing to their unfurl
304+ * blocks or message attachments.
305+ */
306+ unfurls : LinkUnfurls ;
307+ }
308+
309+ /**
310+ * @description The `metadata` param of the `chat.unfurl` API.
311+ */
312+ interface ChatUnfurlMetadata {
313+ /**
314+ * @description Unfurl metadata featuring an array of entities to attach to the message based on URLs featured in the message.
315+ */
316+ metadata : Partial < MessageMetadata > & {
317+ entities : EntityMetadata [ ] ;
318+ } ;
319+ }
320+
289321// https://docs.slack.dev/reference/methods/chat.update
290322export type ChatUpdateArguments = MessageContents & {
291323 /** @description Timestamp of the message to be updated. */
0 commit comments