Using the Brandfolder Text Extraction Tool is a straightforward process that allows you to extract text from images:
Workbench is free up to 5 times a day, per user. Click here to access the Brandfolder Text Extraction Tool
Below is the code extracted from image on the heading of this post. It's not 100% perfect given it's missing a couple of closing brackets, but copying this to your IDE of choice and formatting it and fixing any syntax issues as well as the imports will be much faster than typing the entire code from scratch.
@Service
public class AppService {
private static final Logger LOGGER =
LoggerFactory.getLogger(AppService.class);
private static final String NEW_LINE = "\n";
@Value("${slack.webhook}")
private String urlslackWebHook;
public void sendMessageToSlack(String message) {
StringBuilder messageBuider = new StringBuilder();
messageBuider.append("*My message*:
}
+ message + NEW_LINE);
messageBuider.append("*Item example:* " + exampleMessage() + NEW_LINE);
process(messageBuider.toString());
private void process(String message) {
Payload payload = Payload.builder()
try {
.channel("#app-alerts")
.username("Bob Bot")
.iconEmoji(": rocket:")
.text(message)
.build();
WebhookResponse webhookResponse = Slack.getInstance().send(
urlslackWebHook, payload);
LOGGER.info("code -> " + webhookResponse.getCode());
LOGGER.info("body -> " + webhookResponse.getBody());
} catch (IOException e) {
LOGGER.error("Unexpected Error! WebHook:" + urlslackWebHook);
}
}
}
private String exampleMessage() {
return "Lorem ipsum dolor sit amet, consectetur adipiscing elit.
"
+ "Aliquam eu odio est. Donec viverra hendrerit lacus et tempor.";