Skip to content

Commit

Permalink
feat: 문자 전송 로직 추가(#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Minjae-An committed Mar 14, 2024
1 parent 4e03b0b commit e4c64ae
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions be/src/main/java/yeonba/be/util/SmsService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package yeonba.be.util;

import lombok.RequiredArgsConstructor;
import net.nurigo.sdk.message.model.Message;
import net.nurigo.sdk.message.request.SingleMessageSendingRequest;
import net.nurigo.sdk.message.service.DefaultMessageService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class SmsService {

@Value("${spring.sms.sender}")
private String sender;
private final DefaultMessageService messageService;

public void sendMessage(String to, String text) {
Message message = new Message();
message.setFrom(sender);
message.setTo(to);
message.setText(text);

messageService.sendOne(new SingleMessageSendingRequest(message));
}
}

0 comments on commit e4c64ae

Please sign in to comment.