특정 경우에 대한 알림을 텔레그램으로 전달해달라는 요청이 있어서 작업하다가 정리할 겸 작성하기로했다.
@BotFather 호출
텔레그램 모바일 혹은 웹을 통하여 BotFather를 검색

/start 입력으로 시작
/newbot 입력
1) name 입력 - 중복이 가능하고 변경도 가능하다.
2) username입력 - 중복 불가. 마지막 끝에 “_bot” 또는 “bot”으로 끝나야한다.
토큰 번호 생성
Use this token to access the HTTP API : ~~ 이후 부분이 나의 토큰이다.
토큰 생성 확인
크롬 url에 자신의 토큰 API 키 값을 넣어 접속하면 결과값이 {"ok":true,"result":[]}
와 같은 값이 나온다면 정상이다.
📎 https://api.telegram.org/bot + 토큰 API 키값 + /getUpdateschat_id 확인

t.me/~ 를 클릭 시 해당 봇과 대화를 할 수 있다.
해당 봇에 접근 후 /start 입력 , 그 후 크롬 url에 자신의 토큰 API 키 값을 넣어 접속해보면
📎 https://api.telegram.org/bot + 토큰 API 키값 + /getUpdates결과에서 id에 입력되어 있는 9글자가 chat_id이다.
그룹 채팅방을 만든다. (봇 포함)
아무 채팅이나 보낸다.
chat_id 알아내기
📎 https://api.telegram.org/bot + 토큰 API 키값 + /getUpdates기존 chat_id 입력하는 부분에 그룹채팅방의 chat_id를 입력하면 된다.
@FeignClient(name = "TelegramBotApiInterface"
,url = "${feign.telegram-api.url}"
, configuration = {FeignAutoConfiguration.class})
public interface TelegramBotApiInterface {
@PostMapping(value = "/sendMessage?chat_id={chatId}&text={text}")
Response sendTeleMessage(@PathVariable("chatId")String chatId,@PathVariable("text")String text);
}