allbegray.slack.SlackClientFactory Java Examples
The following examples show how to use
allbegray.slack.SlackClientFactory.
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 |
@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 |
@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: SlackChannel.java From benten with MIT License | 5 votes |
@PostConstruct public void init(){ proxyServerInfo = null; if (bentenProxyConfig.isProxyEnabled()) { logger.info("proxy is enabled using proxy server: "+ bentenProxyConfig.getHost()); proxyServerInfo = new ProxyServerInfo(); proxyServerInfo .setHost(bentenProxyConfig.getHost()); proxyServerInfo .setProtocol(bentenProxyConfig.getProtocol()); proxyServerInfo .setPort(bentenProxyConfig.getPort()); } this.slackRealTimeMessagingClient = SlackClientFactory .createSlackRealTimeMessagingClient(slackProperties.getToken(), proxyServerInfo); this.slackRealTimeMessagingClient.connect(); this.slackWebApiClient = SlackClientFactory .createWebApiClient(slackProperties.getToken(),proxyServerInfo); this.slackRealTimeMessagingClient .addListener(Event.MESSAGE, onMessageEventListener); this.slackRealTimeMessagingClient.addListener(Event.HELLO,helloEventListener); logger.info("Initialized slack client successfully"); }
Example #4
Source File: SlackEventSensor.java From spring-boot-chatbot with MIT License | 5 votes |
private void refreshSlackClient() { log.info("Slack Client Refresh."); if(slackRealTimeMessagingClient != null) { this.slackRealTimeMessagingClient.close(); } slackRealTimeMessagingClient = SlackClientFactory.createSlackRealTimeMessagingClient(token, null, null); slackRealTimeMessagingClient.addListener(MESSAGE, this); slackRealTimeMessagingClient.addListener(GOODBYE_MESSAGE, message -> refreshSlackClient()); slackRealTimeMessagingClient.connect(); }
Example #5
Source File: RemindersTest.java From slack-api with MIT License | 5 votes |
@Before public void setUp() throws Exception { String token = System.getenv().get("auth_token"); assertNotNull(token); webApiClient = SlackClientFactory.createWebApiClient(token); }
Example #6
Source File: SlackDispatcher.java From spring-boot-chatbot with MIT License | 4 votes |
public SlackDispatcher(String token) { this.webApiClient = SlackClientFactory.createWebApiClient(token); }
Example #7
Source File: SlackServiceImpl.java From mirrorgate with Apache License 2.0 | 4 votes |
@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 #8
Source File: GroupsTest.java From slack-api with MIT License | 4 votes |
@Before public void setup() { webApiClient = SlackClientFactory.createWebApiClient(token); }
Example #9
Source File: BotsTest.java From slack-api with MIT License | 4 votes |
@Before public void setup() { webApiClient = SlackClientFactory.createWebApiClient(token); }
Example #10
Source File: DndMethodTest.java From slack-api with MIT License | 4 votes |
@Before public void setup() { webApiClient = SlackClientFactory.createWebApiClient(token); }
Example #11
Source File: ChatPostMessageMethodTest.java From slack-api with MIT License | 4 votes |
@Before public void setup() { webApiClient = SlackClientFactory.createWebApiClient(TOKEN); }
Example #12
Source File: ChatMeMessageMethodTest.java From slack-api with MIT License | 4 votes |
@Before public void setup() { webApiClient = SlackClientFactory.createWebApiClient(token); }