UNPKG

@microfox/slack

Version:

This package provides a lightweight, proxy interface to the official Slack Web API, offering a curated set of the most commonly used functions for building Slack integrations. It is designed to be simple, efficient, and easy to integrate into your project

1,246 lines 643 kB
{ "openapi": "3.0.1", "info": { "title": "Microfox Slack API", "version": "1.0.0", "description": "Single entry-point API for all Microfox Slack functions via a wrapper Lambda", "packageName": "@microfox/slack", "contact": { "name": "Microfox Dev Support", "email": "support@microfox.com" } }, "servers": [ { "url": "https://api.microfox.com/c/slack", "description": "Unified wrapper endpoint" } ], "paths": { "/WebClient/chat-postMessage": { "post": { "operationId": "chat.postMessage", "summary": "Sends a message to a Slack channel.", "description": "The chat.postMessage function allows sending a message to a specified Slack channel, private group, or IM channel. It supports various customization options including text formatting, attachments, blocks, and metadata. The function can be used to send messages as a bot or authenticated user, with options for threading and visibility control.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "body": { "type": "object", "description": "Body of the chat.postMessage sls call", "properties": { "arguments": { "type": "array", "items": [ { "type": "object", "description": "Message configuration object", "properties": { "channel": { "type": "string", "description": "Channel, private group, or IM channel ID to send message to. Can be an encoded ID, or a channel name." }, "text": { "type": "string", "description": "The formatted text of the message to be published. If blocks are included, this will be used as fallback text for notifications." }, "attachments": { "type": "string", "description": "A JSON-based array of structured attachments, presented as a URL-encoded string." }, "blocks": { "type": "string", "description": "A JSON-based array of structured blocks, presented as a URL-encoded string." }, "as_user": { "type": "boolean", "description": "Pass true to post the message as the authed user, instead of as a bot. Defaults to false." }, "icon_emoji": { "type": "string", "description": "Emoji to use as the icon for this message. Overrides icon_url." }, "icon_url": { "type": "string", "description": "URL to an image to use as the icon for this message." }, "link_names": { "type": "boolean", "description": "Find and link user groups." }, "mrkdwn": { "type": "boolean", "description": "Disable Slack markup parsing by setting to false. Enabled by default." }, "metadata": { "type": "string", "description": "JSON object with event_type and event_payload fields, presented as a URL-encoded string." }, "parse": { "type": "string", "description": "Change how messages are treated. Defaults to none." }, "reply_broadcast": { "type": "boolean", "description": "Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false." }, "thread_ts": { "type": "string", "description": "The ts value of another message to reply to." }, "unfurl_links": { "type": "boolean", "description": "Pass true to enable unfurling of primarily text-based content." }, "unfurl_media": { "type": "boolean", "description": "Pass false to disable unfurling of media content." }, "username": { "type": "string", "description": "Set your bot's user name." } }, "required": [ "channel" ] } ] }, "auth": { "type": "object", "description": "Authentication object", "properties": { "strategy": { "type": "string", "description": "Authentication strategy", "enum": [ "apikey" ] }, "variables": { "type": "array", "description": "Variables for the authentication strategy", "items": [ { "type": "object", "properties": { "key": { "type": "string", "description": "SLACK_BOT_TOKEN" }, "value": { "type": "string", "description": "value of SLACK_BOT_TOKEN" } } } ] } } }, "constructorName": { "type": "string", "description": "Name of the constructor to use.", "default": "WebClient" } }, "required": [ "arguments" ] } } } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "description": "true if the request was successful" }, "channel": { "type": "string", "description": "The ID of the channel where the message was posted" }, "ts": { "type": "string", "description": "The timestamp of the message" }, "message": { "type": "object", "description": "An object containing the details of the sent message" } }, "required": [ "ok", "channel", "ts", "message" ] } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "channel_not_found", "not_in_channel", "is_archived", "msg_too_long", "no_text", "too_many_attachments", "rate_limited", "not_authed", "invalid_auth", "account_inactive", "invalid_arg_name", "invalid_array_arg", "invalid_charset", "invalid_form_data", "invalid_post_type", "missing_post_type" ], "description": "Error code explaining the failure" } }, "required": [ "ok", "error" ] } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "fatal_error", "internal_error" ], "description": "Error code indicating a server-side issue" } }, "required": [ "ok", "error" ] } } } } } } }, "/WebClient/chat-update": { "post": { "operationId": "chat.update", "summary": "Updates an existing message in a Slack channel.", "description": "The chat.update method allows you to modify an existing message in a Slack channel. This is particularly useful for updating the status of long-running tasks or providing progressive information to users. The method supports updating the message text, adding structured blocks or attachments, and can be used with various options to control the message's appearance and behavior.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "body": { "type": "object", "description": "Body of the chat.update sls call", "properties": { "arguments": { "type": "array", "items": [ { "type": "object", "description": "Configuration object containing all function parameters", "properties": { "channel": { "type": "string", "description": "The ID of the conversation to update the message in." }, "ts": { "type": "string", "description": "The timestamp of the message to be updated." }, "text": { "type": "string", "description": "The new text for the message. Required if blocks and attachments are not provided." }, "attachments": { "type": "string", "description": "A JSON-based array of structured attachments." }, "blocks": { "type": "array", "description": "An array of structured blocks.", "items": { "type": "object" } }, "as_user": { "type": "boolean", "description": "Pass true to update the message as the authed user. Bot users are considered authed users." }, "link_names": { "type": "boolean", "description": "Find and link channel names and usernames." }, "parse": { "type": "string", "description": "Change how messages are treated. Defaults to 'client'. Can be 'none' or 'full'.", "enum": [ "client", "none", "full" ] }, "metadata": { "type": "string", "description": "A JSON object with event_type and event_payload fields." } }, "required": [ "channel", "ts" ] } ] }, "auth": { "type": "object", "description": "Authentication object", "properties": { "strategy": { "type": "string", "description": "Authentication strategy", "enum": [ "apikey" ] }, "variables": { "type": "array", "description": "Variables for the authentication strategy", "items": [ { "type": "object", "properties": { "key": { "type": "string", "description": "SLACK_BOT_TOKEN" }, "value": { "type": "string", "description": "value of SLACK_BOT_TOKEN" } } } ] } } }, "constructorName": { "type": "string", "description": "Name of the constructor to use.", "default": "WebClient" } }, "required": [ "arguments" ] } } } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "description": "true if the request was successful." }, "channel": { "type": "string", "description": "The ID of the channel where the message was posted." }, "ts": { "type": "string", "description": "The timestamp of the message." }, "text": { "type": "string", "description": "The new text of the message." }, "message": { "type": "object", "description": "An object containing the details of the sent message." } }, "required": [ "ok", "channel", "ts" ] } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "cant_update_message", "channel_not_found", "message_not_found", "edit_window_closed", "msg_too_long", "no_text", "as_user_not_supported", "invalid_blocks", "not_in_channel", "is_archived", "missing_scope", "invalid_arg_name", "invalid_array_arg", "invalid_charset", "invalid_form_data", "invalid_post_type", "missing_post_type" ] } }, "required": [ "ok", "error" ] } } } }, "401": { "description": "Authentication error", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "not_authed", "invalid_auth", "account_inactive", "token_revoked", "no_permission" ] } }, "required": [ "ok", "error" ] } } } }, "429": { "description": "Rate limited", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "const": "ratelimited" } }, "required": [ "ok", "error" ] } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "fatal_error", "internal_error" ] } }, "required": [ "ok", "error" ] } } } }, "503": { "description": "Service unavailable", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "const": "service_unavailable" } }, "required": [ "ok", "error" ] } } } } } } }, "/WebClient/conversations-history": { "post": { "operationId": "conversations.history", "summary": "Fetches a conversation's history of messages and events.", "description": "The conversations.history method retrieves the message and event history for a specified conversation (channel). It allows pagination, filtering by timestamp, and includes options for metadata inclusion. The method returns an array of message objects along with pagination information.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "body": { "type": "object", "description": "Body of the conversations.history sls call", "properties": { "arguments": { "type": "array", "items": [ { "type": "object", "description": "Parameters for fetching conversation history", "properties": { "channel": { "type": "string", "description": "Conversation ID to fetch history for." }, "cursor": { "type": "string", "description": "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request." }, "include_all_metadata": { "type": "boolean", "description": "Return all metadata associated with this message. Default false." }, "inclusive": { "type": "boolean", "description": "Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified." }, "latest": { "type": "string", "description": "Only messages before this Unix timestamp will be included in results." }, "limit": { "type": "integer", "description": "The maximum number of items to return." }, "oldest": { "type": "string", "description": "Only messages after this Unix timestamp will be included in results." } }, "required": [ "channel" ] } ] }, "auth": { "type": "object", "description": "Authentication object", "properties": { "strategy": { "type": "string", "description": "Authentication strategy", "enum": [ "apikey" ] }, "variables": { "type": "array", "description": "Variables for the authentication strategy", "items": [ { "type": "object", "properties": { "key": { "type": "string", "description": "SLACK_BOT_TOKEN" }, "value": { "type": "string", "description": "value of SLACK_BOT_TOKEN" } } } ] } } }, "constructorName": { "type": "string", "description": "Name of the constructor to use.", "default": "WebClient" } }, "required": [ "arguments" ] } } } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "description": "true if the request was successful." }, "messages": { "type": "array", "description": "An array of message objects.", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "The type of message." }, "user": { "type": "string", "description": "The ID of the user who sent the message." }, "text": { "type": "string", "description": "The text of the message." }, "ts": { "type": "string", "description": "The timestamp of the message." } } } }, "has_more": { "type": "boolean", "description": "true if there are more messages to retrieve." }, "pin_count": { "type": "integer", "description": "The number of pinned messages in the channel." }, "response_metadata": { "type": "object", "description": "An object containing pagination information." } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "channel_not_found", "invalid_cursor", "invalid_ts_latest", "invalid_ts_oldest", "not_in_channel", "missing_scope", "invalid_arg_name", "invalid_array_arg", "invalid_charset", "invalid_form_data", "invalid_post_type", "missing_post_type" ] } } } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "not_authed", "invalid_auth", "account_inactive", "token_revoked" ] } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "no_permission" ] } } } } } }, "429": { "description": "Too Many Requests", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "ratelimited", "accesslimited" ] } } } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "fatal_error", "internal_error" ] } } } } } }, "503": { "description": "Service Unavailable", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "const": false }, "error": { "type": "string", "enum": [ "service_unavailable", "team_added_to_org" ] } } } } } } } } }, "/WebClient/conversations-join": { "post": { "operationId": "conversations.join", "summary": "Join an existing public channel in Slack.", "description": "The conversations.join method allows a user or bot to join an existing public channel in a Slack workspace. This is essential for bots that need to be active in specific channels. The method requires a channel ID and returns details about the joined conversation.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "body": { "type": "object", "description": "Body of the conversations.join sls call", "properties": { "arguments": { "type": "array", "items": [ { "type": "object", "properties": { "channel": { "type": "string", "description": "The ID of the conversation to join." } }, "required": [ "channel" ], "description": "Parameters for joining a conversation" } ] }, "auth": { "type": "object", "description": "Authentication object", "properties": { "strategy": { "type": "string", "description": "Authentication strategy", "enum": [ "apikey" ] }, "variables": { "type": "array", "description": "Variables for the authentication strategy", "items": [ { "type": "object", "properties": { "key": { "type": "string", "description": "SLACK_BOT_TOKEN" }, "value": { "type": "string", "description": "value of SLACK_BOT_TOKEN" } } } ] } } }, "constructorName": { "type": "string", "description": "Name of the constructor to use.", "default": "WebClient" } }, "required": [ "arguments" ] } } } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "description": "Indicates if the request was successful" }, "channel": { "type": "object", "properties": { "id": { "type": "string", "description": "The ID of the conversation" }, "name": { "type": "string", "description": "The name of the channel-like thing" }, "is_channel": { "type": "boolean", "description": "Indicates whether a conversation is a channel" }, "is_group": { "type": "boolean", "description": "Means the channel is a private channel created before March 2021" }, "is_im": { "type": "boolean", "description": "Means the conversation is a direct message between two distinguished individuals or a user and a bot" }, "is_mpim": { "type": "boolean", "description": "Represents an unnamed private conversation between multiple users" }, "is_private": { "type": "boolean", "description": "Means the conversation is privileged between two or more members" }, "created": { "type": "integer", "description": "Timestamp of when the conversation was created" }, "creator": { "type": "string", "description": "The ID of the member that created this conversation" }, "is_archived": { "type": "boolean", "description": "Indicates a conversation is archived" }, "is_general": { "type": "boolean", "description": "Means the channel is the workspace's \"general\" discussion channel" }, "unlinked": { "type": "integer", "description": "The number of members that have been removed from the channel" }, "name_normalized": { "type": "string", "description": "The channel name, but with any special characters replaced" }, "is_shared": { "type": "boolean", "description": "Indicates whether a conversation is part of a Shared Channel" }, "is_ext_shared": { "type": "boolean", "description": "Indicates whether a conversation is part of a Shared Channel with a remote organization" }, "is_org_shared": { "type": "boolean", "description": "Indicates whether this shared channel is shared between Enterprise Grid workspaces within the same organization" }, "pending_shared": { "type": "array", "description": "A list of team IDs that have been invited to the channel but have not yet joined" }, "is_pending_ext_shared": { "type": "boolean", "description": "Means the conversation is ready to become an is_ext_shared channel, but needs some kind of approval or sign off first" }, "is_member": { "type": "boolean", "description": "Indicates whether the user, bot user or Slack app is a member of the conversation" }, "topic": { "type": "object", "description": "Provides information about the channel topic" }, "purpose": { "type": "object", "description": "Provides information about the channel purpose" }, "previous_names": { "type": "array", "description": "A list of previous names for the channel" }, "num_members": { "type": "integer", "description": "The number of members in the conversation" } } } }, "required": [ "ok", "channel" ] } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "enum": [ false ], "description": "Indicates the request was unsuccessful" }, "error": { "type": "string", "enum": [ "channel_not_found", "is_archived", "method_not_supported_for_channel_type", "missing_scope", "not_authed", "invalid_auth", "account_inactive", "token_revoked", "no_permission", "user_is_restricted" ], "description": "Error code explaining the failure" } }, "required": [ "ok", "error" ] } } } }, "500": { "description": "Server error", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "enum": [ false ], "description": "Indicates the request was unsuccessful" }, "error": { "type": "string", "enum": [ "fatal_error", "internal_error" ], "description": "Error code explaining the failure" } }, "required": [ "ok", "error" ] } } } }, "503": { "description": "Service unavailable", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean", "enum": [ false ], "description": "Indicates the request was unsuccessful" }, "error": { "type": "string", "enum": [ "service_unavailable" ], "description": "Error code explaining the failure" } }, "required": [ "ok", "error" ] } } } } } } }, "/WebClient/conversations-list": { "post": { "operationId": "conversations.list", "summary": "Retrieves a list of conversations (channels, private channels, DMs, and MPDMs) in a Slack workspace.", "description": "The conversations.list method allows you to fetch a list of conversations in a Slack workspace. It supports pagination and filtering options to customize the results. The method returns detailed information about each conversation, including its type, members, and various attributes.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "body": { "type": "object", "description": "Body of the conversations.list sls call", "properties": { "arguments": { "type": "array", "items": [ { "type": "object", "description": "Parameters for filtering and paginating conversation results", "properties": { "cursor": { "type": "string", "description": "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request." }, "exclude_archived": { "type": "boolean", "description": "Set to true to exclude archived channels from the list. Default is false." }, "limit": { "type": "integer", "description": "The maximum number of items to return. Must be an integer under 1000. Default is 100.", "minimum": 1, "maximum": 999 }, "team_id": { "type": "string", "description": "Required for org-wide apps." }, "types": { "type": "string", "description": "A comma-separated list of conversation types to include. Types can be public_channel, private_channel, mpim, and im. Default is public_channel." } } } ] }, "auth": { "type": "object", "description": "Authentication object", "properties": { "strategy": { "