Package com.privalia.qa.utils
Class SlackConnector
- java.lang.Object
-
- com.privalia.qa.utils.SlackConnector
-
public class SlackConnector extends Object
An small utility for posting messages in slack- Author:
- José Fernández
-
-
Field Summary
Fields Modifier and Type Field Description static String
SLACK_PROPERTIES_FILE
-
Constructor Summary
Constructors Constructor Description SlackConnector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getChannels(List<String> tags)
Parses the provided set of tags and returns all the channels referenced by the slack tag.List<com.slack.api.methods.response.chat.ChatPostMessageResponse>
sendMessageToChannels(List<String> channels, String message)
Sends the given message to the specified list of channels.
-
-
-
Field Detail
-
SLACK_PROPERTIES_FILE
public static final String SLACK_PROPERTIES_FILE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getChannels
public List<String> getChannels(List<String> tags)
Parses the provided set of tags and returns all the channels referenced by the slack tag.- Parameters:
tags
- List of tags (i.e @ignore, @slack(#channel1,#channel2,#channel3))- Returns:
- A list of all the channels contained in the slack tag (i.e {#channel1,#channel2,#channel3})
-
sendMessageToChannels
public List<com.slack.api.methods.response.chat.ChatPostMessageResponse> sendMessageToChannels(List<String> channels, String message) throws com.slack.api.methods.SlackApiException, IOException
Sends the given message to the specified list of channels. For more information and settings, you can check the attached link.- Parameters:
channels
- List of channelsmessage
- Text to send- Returns:
- List of
ChatPostMessageResponse
- Throws:
com.slack.api.methods.SlackApiException
- SlackApiExceptionIOException
- IOException- See Also:
- Sends a message to a channel.
-
-