allbegray.slack.webapi.SlackWebApiClient Java Examples

The following examples show how to use allbegray.slack.webapi.SlackWebApiClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SlackNotifier.java    From yfiton with Apache License 2.0 7 votes vote down vote up
@Override
protected void notify(Parameters parameters) throws NotificationException {
    SubnodeConfiguration config = retrieveTeamInformation();

    if (config == null) {
        throw new NotificationException("Invalid configuration");
    }

    SlackWebApiClient slackClient =
            SlackClientFactory.createWebApiClient(config.getString("accessToken"));

    ChatPostMessageMethod chatPostMessageMethod =
            new ChatPostMessageMethod(channel, message);
    chatPostMessageMethod.setAs_user(true);

    slackClient.postMessage(chatPostMessageMethod);

    log.info("https://" + config.getString("teamName") + ".slack.com/messages/" + channel + "/");
}
 
Example #2
Source File: SlackNotifier.java    From yfiton with Apache License 2.0 6 votes vote down vote up
@Override
protected void notify(Parameters parameters) throws NotificationException {
    SubnodeConfiguration config = retrieveTeamInformation();

    if (config == null) {
        throw new NotificationException("Invalid configuration");
    }

    SlackWebApiClient slackClient =
            SlackClientFactory.createWebApiClient(config.getString("accessToken"));

    ChatPostMessageMethod chatPostMessageMethod =
            new ChatPostMessageMethod(channel, message);
    chatPostMessageMethod.setAs_user(true);

    slackClient.postMessage(chatPostMessageMethod);

    log.info("https://" + config.getString("teamName") + ".slack.com/messages/" + channel + "/");
}
 
Example #3
Source File: SlackServiceImpl.java    From mirrorgate with Apache License 2.0 4 votes vote down vote up
@Override
public Map<String, String> getChannelList(final String slackToken) {
    final SlackWebApiClient webApiClient = SlackClientFactory.createWebApiClient(slackToken);
    final List<Channel> channelList = webApiClient.getChannelList();
    return channelList.stream().collect(Collectors.toMap(Channel::getId, Channel::getName));
}
 
Example #4
Source File: SlackClientFactory.java    From slack-api with MIT License 4 votes vote down vote up
public static SlackWebApiClient createWebApiClient(String token) {
	return new SlackWebApiClientImpl(token);
}
 
Example #5
Source File: SlackClientFactory.java    From slack-api with MIT License 4 votes vote down vote up
public static SlackWebApiClient createWebApiClient(String token, ProxyServerInfo proxyServerInfo) {
	return new SlackWebApiClientImpl(token, proxyServerInfo);
}
 
Example #6
Source File: SlackClientFactory.java    From slack-api with MIT License 4 votes vote down vote up
public static SlackWebApiClient createWebApiClient(String token, ObjectMapper mapper) {
	return new SlackWebApiClientImpl(token, mapper);
}
 
Example #7
Source File: SlackClientFactory.java    From slack-api with MIT License 4 votes vote down vote up
public static SlackWebApiClient createWebApiClient(String token, ObjectMapper mapper, ProxyServerInfo proxyServerInfo) {
	return new SlackWebApiClientImpl(token, mapper, proxyServerInfo);
}
 
Example #8
Source File: SlackClientFactory.java    From slack-api with MIT License 4 votes vote down vote up
public static SlackWebApiClient createWebApiClient(String token, ObjectMapper mapper, int timeout) {
	return new SlackWebApiClientImpl(token, mapper, timeout);
}
 
Example #9
Source File: SlackClientFactory.java    From slack-api with MIT License 4 votes vote down vote up
public static SlackWebApiClient createWebApiClient(String token, ObjectMapper mapper, int timeout, ProxyServerInfo proxyServerInfo) {
	return new SlackWebApiClientImpl(token, mapper, timeout, proxyServerInfo);
}
 
Example #10
Source File: SlackClientFactory.java    From slack-api with MIT License 4 votes vote down vote up
public static SlackRealTimeMessagingClient createSlackRealTimeMessagingClient(String token, ObjectMapper mapper, ProxyServerInfo proxyServerInfo) {
	SlackWebApiClient webApiClient = createWebApiClient(token, proxyServerInfo);
	String webSocketUrl = webApiClient.startRealTimeMessagingApi().findPath("url").asText();
	return new SlackRealTimeMessagingClient(webSocketUrl, mapper, proxyServerInfo);
}