Package com.chatmotorapi.api.notify
Class SlackNotificationChannel
java.lang.Object
com.chatmotorapi.api.notify.SlackNotificationChannel
- All Implemented Interfaces:
NotificationChannel
public class SlackNotificationChannel extends Object implements NotificationChannel
The SlackNotificationChannel class handles posting messages and files to a specified
Slack channel as part of response post-treatment processes. It provides methods to send messages
and files either synchronously or asynchronously, depending on the specified ExecutionMode.
Usage
To create an instance of SlackNotificationChannel, use the nested SlackNotificationChannel.Builder class.
The following fields are required:
- token: Your Slack API token for authentication.
- channel: The Slack channel ID where messages and files will be sent.
Optional field:
- logger: A custom
Loggerinstance for logging operations. If not provided, a default logger will be used.
Example:
SlackNotificationChannel slackNotificationChannel = new SlackNotificationChannel.Builder()
.chatMotor(chatMotor)
.token("your-slack-token")
.channel("your-channel-id")
.logger(LoggerFactory.getLogger(YourClass.class))
.build();
After building the instance, you can use the notifyDocumentAvailable and dispatchDocument
methods to send messages and files to Slack.
- See Also:
SlackNotificationChannel.Builder
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSlackNotificationChannel.BuilderBuilder class forSlackNotificationChannel. -
Method Summary
Modifier and Type Method Description MotorNotifyResponsedispatchDocument(String filePath, ExecutionMode mode)Sends the generated response document to the user.MotorNotifyResponsenotifyDocumentAvailable(String filePath, ExecutionMode mode)Notifies the user that a response document is available.
-
Method Details
-
notifyDocumentAvailable
Description copied from interface:NotificationChannelNotifies the user that a response document is available.- Specified by:
notifyDocumentAvailablein interfaceNotificationChannel- Parameters:
filePath- the file path of the response document that is availablemode- the execution mode, either synchronous (SYNC) or asynchronous (ASYNC)- Returns:
- a MotorNotifyResponse object containing the result of the notification process
-
dispatchDocument
Description copied from interface:NotificationChannelSends the generated response document to the user.- Specified by:
dispatchDocumentin interfaceNotificationChannel- Parameters:
filePath- the file path of the response document to be sentmode- the execution mode, either synchronous (SYNC) or asynchronous (ASYNC)- Returns:
- a MotorNotifyResponse object containing the result of the document dispatch process
-