api

Slack API, webHook

C/H 2017. 3. 29. 08:30

Slack Incoming WebHooks
curl -X POST --data-urlencode 'payload={"channel": "#general", "username": "webhookbot", "text": "This is posted to #general and comes from a bot named webhookbot.", "icon_emoji": ":ghost:"}' https://hooks.slack.com/services/KEY1/KEY2/TOKEN

curl --data "CHAT_MESSAGE" 'https://EXAMPLE.slack.com/services/hooks/slackbot?token=TOKEN&channel=%23CHANNEL_NAME'

curl -X POST -d "token=TOKEN&channel=CHANNEL_NAME&text=CHAT_MESSAGE&username=USERNAME" https://slack.com/api/chat.postMessage

curl -X POST --data-urlencode 'payload={"channel": "#CHANNLE", "username": "USERNAME", "icon_emoji": ":hear_no_evil:",
    "attachments": [
        {
            "color": "#36a64f",
            "pretext": "PRETEXT",
            "text": "TEXT1
TEST2
TEST3",
            "footer": "Slack API",
            "footer_icon": "https://platform.slack-edge.com/img/default_application_icon.png",
            "ts": '$(date +%s)'
        }
    ]
}' https://hooks.slack.com/services/KEY1/KEY2/TOKEN 



반응형