slackposter: Index | Files

package slackposter

import ""

Package slackposter posts a payload to Slack incoming webhook.

See for more info.


Package Files

doc.go slackposter.go

type Attachment Uses

type Attachment struct {
    AuthorIcon string   `json:"author_icon"`
    AuthorLink string   `json:"author_link"`
    AuthorName string   `json:"author_name"`
    Color      string   `json:"color"`
    Fallback   string   `json:"fallback"`
    Fields     []Field  `json:"fields"`
    FooterIcon string   `json:"footer_icon"`
    Footer     string   `json:"footer"`
    ImageURL   string   `json:"image_url"`
    MrkdwnIn   []string `json:"mrkdwn_in"`
    Pretext    string   `json:"pretext"`
    Text       string   `json:"text"`
    ThumbURL   string   `json:"thumb_url"`
    TitleLink  string   `json:"title_link"`
    Title      string   `json:"title"`
    Ts         int64    `json:"ts"`

Attachment represents a `attachment`.

type Config Uses

type Config struct {
    Channel    string `json:"channel"`
    IconEmoji  string `json:"icon_emoji"`
    Username   string `json:"username"`
    WebhookURL string `json:"webhook_url"`

Config is the configuration of SlackPoster.

type Field Uses

type Field struct {
    Short bool   `json:"short"`
    Title string `json:"title"`
    Value string `json:"value"`

Field represents a `field`.

type Payload Uses

type Payload struct {
    Attachments []Attachment `json:"attachments"`
    Channel     string       `json:"channel"`
    IconEmoji   string       `json:"icon_emoji"`
    LinkNames   bool         `json:"link_names"`
    Mrkdwn      bool         `json:"mrkdwn"`
    Text        string       `json:"text"`
    Username    string       `json:"username"`

Payload is represented a Slack messsage format.

Refer to: Attaching content and links to messages | Slack

func (*Payload) AppendField Uses

func (payload *Payload) AppendField(field Field, attachmentIndex int)

AppendField append a Field to Attachments.

type SlackPoster Uses

type SlackPoster struct {
    Channel    string
    DryRun     bool
    IconEmoji  string
    Username   string
    WebhookURL string

SlackPoster represents a poster for Slack incoming webhook. SlackPoster must be created by calling NewSlackPoster().

func NewSlackPoster Uses

func NewSlackPoster(c Config) SlackPoster

NewSlackPoster create a new SlackPoster given a Config.

func (SlackPoster) NewPayload Uses

func (sp SlackPoster) NewPayload() Payload

NewPayload create a new Payload.

func (SlackPoster) PostMessage Uses

func (sp SlackPoster) PostMessage(message string) error

PostMessage posts a message to WebhookURL.

func (SlackPoster) PostPayload Uses

func (sp SlackPoster) PostPayload(payload Payload) error

PostPayload posts a payload to WebhookURL.

Package slackposter imports 5 packages (graph). Updated 2017-11-01. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).