Slack is real-time messaging, archiving and search for teams. This togglz-slack module allows to notify your team about feature toggles changes.
- Set up an incoming webhook integration in your Slack team.
- Copy your own webhook URL from Slack website.
- Add
togglz-slackartifact to your project dependencies and configure it.
SlackStateRepository wrap your existing StateRepositoryadding notifications on setFeatureState.
@Configuration
public class TogglzSlackConfig {
@Bean
public NotificationConfiguration notificationConfiguration(@Value("${togglz.slack.hookUrl}" hookUrl){
return NotificationConfiguration.builder()
.withSlackHookUrl(hookUrl)
// more (optional) configuration here
.build();
}
@Bean
public SlackStateRepository slackStateRepository(StateRepository wrapped, NotificationConfiguration config, UserProvider users) {
return new SlackStateRepository(wrapped, config, users)
}
}
You need to provide wrapped bean (your old StateRepository) and togglz.slack.hookUrl in properties.
Now you can use SlackStateRepository to persist toggles state and to have Slack notifications at the same time.
Read more about Java-based container configuration.