Created
July 1, 2018 18:29
-
-
Save skwee357/a0ec7bc3533dd67de86944ce4ce528aa to your computer and use it in GitHub Desktop.
@slack/interactive-messages Typings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as http from "http"; | |
export interface MessageAdapterOptions { | |
syncResponseTimeout: number; | |
lateResponseFallbackEnabled: boolean; | |
} | |
export interface ActionMatchingConstraints { | |
callbackId?: string | RegExp; | |
type?: "select" | "button" | "dialog_submission"; | |
unfurl?: boolean; | |
} | |
export interface CallbackPayloadButton { | |
type: "interactive_message"; | |
actions: { | |
name: string; | |
value: string; | |
type: "button"; | |
}[]; | |
callback_id: string; | |
team: { | |
id: string; | |
domain: string; | |
}; | |
channel: { | |
id: string; | |
name: string; | |
}; | |
user: { | |
id: string; | |
name: string; | |
}; | |
action_ts: string; | |
message_ts: string; | |
token: string; | |
original_message: any; | |
response_url: string; | |
trigger_id: string; | |
} | |
export interface CallbackPayloadMenu { | |
type: "interactive_message"; | |
actions: { | |
name: string; | |
selected_options: { value: string; }[]; | |
}[]; | |
callback_id: string; | |
team: { | |
id: string; | |
domain: string; | |
}; | |
channel: { | |
id: string; | |
name: string; | |
}; | |
user: { | |
id: string; | |
name: string; | |
}; | |
action_ts: string; | |
message_ts: string; | |
attachment_id: string; | |
token: string; | |
original_message: any; | |
response_url: string; | |
trigger_id: string; | |
} | |
export interface CallbackPayloadDialog { | |
type: "dialog_submission"; | |
submission: any; | |
callback_id: string; | |
team: { | |
id: string; | |
domain: string; | |
}; | |
channel: { | |
id: string; | |
name: string; | |
}; | |
user: { | |
id: string; | |
name: string; | |
}; | |
action_ts: string; | |
token: string; | |
response_url: string; | |
} | |
type ResponseCallback = (message: any) => Promise<any>; | |
type CallbackFunction = (payload: CallbackPayloadButton | CallbackPayloadDialog | CallbackPayloadMenu, respond: ResponseCallback) => object; | |
interface SlackMessageAdapter { | |
createServer(path: string): Promise<http.Server>; | |
start(port: number): Promise<void>; | |
stop(): Promise<void>; | |
action(matchingConstraints: string | RegExp | ActionMatchingConstraints, callback: CallbackFunction): SlackMessageAdapter; | |
} | |
export function createMessageAdapter(verificationToken: string, options?: MessageAdapterOptions): SlackMessageAdapter; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment