To post messages about the change in task status from Kafka into Slack, you need to configure an incoming Webhook URL at Slack.
For more information about configuring Webhook URL at Slack, see https://api.slack.com/incoming-webhooks.
- Go to https://<slack_room_name>.slack.com/apps/build/custom-integration.
- Select Incoming WebHooks.
- From the Post to Channel field, select a channel where to post messages from Kafka events, or create a new channel.
- Click Add Incoming WebHooks integration to generate a Webhook URL.
- Add the generated URL to the Java class.
Define the message body in the java class, for example:
messageBody = "The state of task *" + dataEvent.getResourceId() + "* has been updated from *" + fieldModification.getPreviousValue() + "* to *" + fieldModification.getNewValue() + "*.";
- Save your changes.
Whenever a task changes status to Resolved in Talend Data Stewardship, a message will be posted to the specified channel in Slack as below: