Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Message Metadata support #1504

Merged
merged 3 commits into from Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/types/src/index.ts
Expand Up @@ -366,6 +366,17 @@ export interface InputBlock extends Block {
dispatch_action?: boolean;
}

export interface MessageMetadata {
event_type: string;
event_payload: {
[key: string]: string | number | boolean | MessageMetadataEventPayloadObject | MessageMetadataEventPayloadObject[];
}
}

export interface MessageMetadataEventPayloadObject {
[key: string]: string | number | boolean
}

export interface MessageAttachment {
blocks?: (KnownBlock | Block)[];
fallback?: string; // either this or text must be defined
Expand Down
5 changes: 4 additions & 1 deletion packages/web-api/src/methods.ts
@@ -1,5 +1,5 @@
import { Stream } from 'stream';
import { Dialog, View, KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser } from '@slack/types';
import { Dialog, View, KnownBlock, Block, MessageAttachment, LinkUnfurls, CallUser, MessageMetadata } from '@slack/types';
import { EventEmitter } from 'eventemitter3';
import { WebAPICallOptions, WebAPICallResult, WebClient, WebClientEvent } from './WebClient';
import {
Expand Down Expand Up @@ -1412,6 +1412,7 @@ export interface ChatPostMessageArguments extends WebAPICallOptions, TokenOverri
blocks?: (KnownBlock | Block)[];
icon_emoji?: string; // if specified, as_user must be false
icon_url?: string; // if specified, as_user must be false
metadata?: MessageMetadata;
link_names?: boolean;
mrkdwn?: boolean;
parse?: 'full' | 'none';
Expand All @@ -1428,6 +1429,7 @@ export interface ChatScheduleMessageArguments extends WebAPICallOptions, TokenOv
as_user?: boolean;
attachments?: MessageAttachment[];
blocks?: (KnownBlock | Block)[];
metadata?: MessageMetadata;
link_names?: boolean;
parse?: 'full' | 'none';
reply_broadcast?: boolean; // if specified, thread_ts must be set
Expand Down Expand Up @@ -1460,6 +1462,7 @@ export interface ChatUpdateArguments extends WebAPICallOptions, TokenOverridable
attachments?: MessageAttachment[];
blocks?: (KnownBlock | Block)[];
link_names?: boolean;
metadata?: MessageMetadata;
parse?: 'full' | 'none';
file_ids?: string[];
reply_broadcast?: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add include_all_metadata parameter to conversations.history API too? https://api.slack.com/methods/conversations.history#arg_include_all_metadata

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this is done 👍

Expand Down