Module for sending messages to Slack
2015.5.0 新版功能.
configuration: | This module can be used by either passing an api key and version directly or by specifying both in a configuration profile in the salt master/minion config. For example: slack:
api_key: peWcBiMOS9HrZG15peWcBiMOS9HrZG15
|
---|
salt.modules.slack_notify.
call_hook
(message, attachment=None, color='good', short=False, identifier=None)¶Send message to Slack incomming webhook.
参数: |
|
---|---|
返回: | Boolean if message was sent successfuly. |
CLI Example:
salt '*' slack.post_hook message='Hello, from SaltStack'
salt.modules.slack_notify.
find_room
(name, api_key=None)¶Find a room by name and return it.
参数: |
|
---|---|
返回: | The room object. |
CLI Example:
salt '*' slack.find_room name="random"
salt '*' slack.find_room name="random" api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15
salt.modules.slack_notify.
find_user
(name, api_key=None)¶Find a user by name and return it.
参数: |
|
---|---|
返回: | The user object. |
CLI Example:
salt '*' slack.find_user name="ThomasHatch"
salt '*' slack.find_user name="ThomasHatch" api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15
salt.modules.slack_notify.
list_rooms
(api_key=None)¶List all Slack rooms.
参数: | api_key -- The Slack admin api key. |
---|---|
返回: | The room list. |
CLI Example:
salt '*' slack.list_rooms
salt '*' slack.list_rooms api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15
salt.modules.slack_notify.
list_users
(api_key=None)¶List all Slack users.
参数: | api_key -- The Slack admin api key. |
---|---|
返回: | The user list. |
CLI Example:
salt '*' slack.list_users
salt '*' slack.list_users api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15
salt.modules.slack_notify.
post_message
(channel, message, from_name, api_key=None, icon=None)¶Send a message to a Slack channel.
参数: |
|
---|---|
返回: | Boolean if message was sent successfully. |
CLI Example:
salt '*' slack.post_message channel="Development Room" message="Build is done" from_name="Build Server"