Skip to content

Instantly share code, notes, and snippets.

@GeekTree0101
Created August 12, 2019 00:22
Show Gist options
  • Save GeekTree0101/883a16308a9b1f135c450f3f6a448e13 to your computer and use it in GitHub Desktop.
Save GeekTree0101/883a16308a9b1f135c450f3f6a448e13 to your computer and use it in GitHub Desktop.
Golang Slack Model
// SlackMessage is SlackMessage object
type SlackMessage struct {
Type string `json:"response_type"` // key: type default: in_channel
Text string `json:"text"`
Attatchments []SlackMessageAttachment `json:"attachments"`
}
// SlackMessageAttachment is SlackMessage attachment object
type SlackMessageAttachment struct {
Title string `json:"title"`
Text string `json:"text"`
Color string `json:"color"`
TitleURLString string `json:"title_link"`
Fields []SlackMessageAttachmentField `json:"fields"`
}
// SlackMessageAttachmentField is attachment fields
type SlackMessageAttachmentField struct {
Title string `json:"title"`
Value string `json:"value"`
Short bool `json:"shrot"`
}
// SlackCommand is commend request object
type SlackCommand struct {
Token string `json:"token"`
ChannelName string `json:"channel_name"`
Command string `json:"command"`
Text string `json:"text"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment