class Slack::Api::ChatPostMessage

Defined in:

slack/api/endpoints/chat_post_message.cr

Constant Summary

ASSIGNED_TYPES = [attachments : Array(EventData::Attachment) | ::Nil, blocks : Array(Slack::UI::Block) | ::Nil, channel : String, text : String | ::Nil, token : String, icon_emoji : String | ::Nil, icon_url : String | ::Nil, link_names : Bool | ::Nil, mrkdwn : Bool | ::Nil, parse : String | ::Nil = "none", reply_broadcast : Bool | ::Nil, thread_ts : String | ::Nil, unfurl_links : Bool | ::Nil, unfurl_media : Bool | ::Nil, username : String | ::Nil] of TypeDeclaration

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Slack::Api::Base

base_url base_url, call : Slack::Model call, content_type : ContentTypes content_type, headers headers, token token

Constructor methods inherited from class Slack::Api::Base

new(pull : JSON::PullParser) new

Constructor Detail

def self.new(channel : String, token : String, attachments : Array(EventData::Attachment) | Nil = nil, blocks : Array(Slack::UI::Block) | Nil = nil, text : String | Nil = nil, icon_emoji : String | Nil = nil, icon_url : String | Nil = nil, link_names : Bool | Nil = nil, mrkdwn : Bool | Nil = nil, parse : String | Nil = "none", reply_broadcast : Bool | Nil = nil, thread_ts : String | Nil = nil, unfurl_links : Bool | Nil = nil, unfurl_media : Bool | Nil = nil, username : String | Nil = nil) #

def self.new(pull : JSON::PullParser) #

[View source]

Class Method Detail

def self.post_blocks(blocks : Enumerable, channel : String, token : String, thread_ts : String | Nil = nil) #

Add a helper so Array(Slack::UI::Block) can be easily passed for calls that allow mixed blocks. (chat.postMessage, etc). This is a bit of a hack to get around the fact that the Array could be many different types depending on the user, as the user is creating the Array type -- e.g:

Array(Slack::UI::Blocks::Section | Slack::UI::Blocks::Input)?

This should be improved with something that handles type guards a bit more elegantly or something that propertly handles the combinatorics on arrays.


[View source]

Instance Method Detail

def after_initialize #

[View source]
def attachments : Array(EventData::Attachment) | Nil #

def attachments=(attachments : Array(EventData::Attachment) | Nil) #

def base_url #

[View source]
def blocks : Array(Slack::UI::Block) | Nil #

def blocks=(blocks : Array(Slack::UI::Block) | Nil) #


[View source]
def channel : String #

def channel=(channel : String) #

def content_type : ContentTypes #

[View source]
def icon_emoji : String | Nil #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def icon_emoji=(icon_emoji : String | Nil) #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def icon_url : String | Nil #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def icon_url=(icon_url : String | Nil) #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def link_names : Bool | Nil #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def link_names=(link_names : Bool | Nil) #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def mrkdwn : Bool | Nil #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def mrkdwn=(mrkdwn : Bool | Nil) #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def parse : String | Nil #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def parse=(parse : String | Nil) #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def reply_broadcast : Bool | Nil #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def reply_broadcast=(reply_broadcast : Bool | Nil) #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def text : String | Nil #

def text=(text : String | Nil) #

def thread_ts : String | Nil #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def thread_ts=(thread_ts : String | Nil) #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def token : String #

def token=(token : String) #

def unfurl_links : Bool | Nil #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def unfurl_links=(unfurl_links : Bool | Nil) #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def unfurl_media : Bool | Nil #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def unfurl_media=(unfurl_media : Bool | Nil) #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def username : String | Nil #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage


def username=(username : String | Nil) #

Extract this into a configuration object.

Options -- https://api.slack.com/methods/chat.postMessage