-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
5 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,12 +40,16 @@ public Function<Request, Object> getExecutor() { | |
// Put the callingNumber in the subject if it exists, it might not if using lex console for example | ||
final var subject = getCallingNumber() == null ? r.subject : | ||
"[From " + getCallingNumber() + "] " + r.subject; | ||
|
||
// If ChatGPT returns something that looks like an Object, convert to JSON and then to Pretty String | ||
final var message_body = r.message instanceof String ? r.message : mapper.valueToTree(r.message).toPrettyString(); | ||
|
||
final var ses = SesClient.create(); | ||
final var id = ses.sendEmail((email) -> { | ||
email.destination(dest -> dest.toAddresses(r.employee_email)) | ||
.message((mesg) -> { | ||
mesg.body((body) -> { | ||
body.text(cont -> cont.data(r.message)); | ||
body.text(cont -> cont.data(message_body)); | ||
}).subject(cont -> cont.data(subject)); | ||
}).source("[email protected]"); | ||
}); | ||
|