Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Optional;

@RequiredArgsConstructor
@Service
Expand All @@ -27,6 +28,9 @@ public class KakaoNotificationService {
@Value("${kakao.message-send-uri}")
private String messageSendUri;

@Value("${kakao.basic-image-url}")
private String basicImageUrl;

private final RestClient kakaoRestClient;
private final AesEncryptor aesEncryptor;

Expand All @@ -40,6 +44,9 @@ public void sendListTemplate(User user, List<NotificationItemRequest> notificati

for (int i = 0; i < notificationItemRequests.size(); i++) {
NotificationItemRequest item = notificationItemRequests.get(i);
String title = Optional.ofNullable(item.title()).orElse("제목 없음");
String description = Optional.ofNullable(item.description()).orElse(" ");
String imageUrl = Optional.ofNullable(item.imageUrl()).orElse(basicImageUrl);
contentsJson.append("""
{
"title": "%s",
Expand All @@ -53,9 +60,9 @@ public void sendListTemplate(User user, List<NotificationItemRequest> notificati
}
}
""".formatted(
escapeJson(item.title()),
escapeJson(item.description()),
escapeJson(item.imageUrl()),
escapeJson(title),
escapeJson(description),
escapeJson(imageUrl),
linkedUrl,
linkedUrl
));
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ kakao:
linked-url: ${KAKAO_LINKED_URL}
message-send-uri: /v2/api/talk/memo/default/send
notification-title : ${KAKAO_NOTIFICATION_TITLE}
basic-image-url : ${KAKAO_BASIC_IMAGE_URL}

springdoc:
swagger-ui:
Expand Down