diff --git a/src/types/events/base-events.spec.ts b/src/types/events/base-events.spec.ts new file mode 100644 index 000000000..f852e8438 --- /dev/null +++ b/src/types/events/base-events.spec.ts @@ -0,0 +1,41 @@ +import { assert } from 'chai'; +import { AppMentionEvent } from './base-events'; + +describe('Events API payload types', () => { + it('should be compatible with app_mention payload', () => { + const payload: AppMentionEvent = { + type: 'app_mention', + text: '<@U066C7XNE6M> hey', + files: [{ id: 'F111' }], + upload: false, + user: 'U03E94MK0', + display_as_bot: false, + ts: '1707806347.397809', + blocks: [ + { + type: 'rich_text', + block_id: 't9D3L', + elements: [ + { + type: 'rich_text_section', + elements: [ + { + type: 'user', + user_id: 'U066C7XNE6M', + }, + { + type: 'text', + text: ' hey', + }, + ], + }, + ], + }, + ], + client_msg_id: '883e5317-28e3-4ef8-9385-b88343560de6', + channel: 'CHE2DUW5V', + event_ts: '1707806347.397809', + }; + assert.isNotEmpty(payload); + }); +}); diff --git a/src/types/events/base-events.ts b/src/types/events/base-events.ts index 8c5bdb9be..b5ad2a2bd 100644 --- a/src/types/events/base-events.ts +++ b/src/types/events/base-events.ts @@ -189,12 +189,16 @@ export interface AppMentionEvent { subtype?: string; bot_id?: string; bot_profile?: BotProfile; - username: string; + username?: string; team?: string; user?: string; text: string; attachments?: MessageAttachment[]; blocks?: (KnownBlock | Block)[]; + // TODO: Add more properties once the types library has a file object definition + files?: { id: string }[]; + upload?: boolean; + display_as_bot?: boolean; edited?: { user: string; ts: string; @@ -203,6 +207,7 @@ export interface AppMentionEvent { channel: string; event_ts: string; thread_ts?: string; + client_msg_id?: string; } export interface AppRateLimitedEvent {