알림톡을 추가할 때, 카카오 비즈니스를 통해 직접하는 것보다 Bizm이라는 알림톡 대행 서비스를 사용하는 것이 편리하다.
비즈엠 - 카카오톡 비즈메시지 공식딜러사
알림톡 친구톡 싸고 편하게 전송
www.bizmsg.kr
Bizm 가이드를 따라면, 프로필과 userid 값을 받을 수 있다.
// bizm.service.ts @Injectable() export class BizmService { async sendMessage(phone: string, templateId: string, message: string) { return axios.post( 'https://alimtalk-api.bizmsg.kr/v2/sender/send', [ { message_type: 'at', phn: '82' + Number(phone), profile: process.env.BIZM_PROFILE, tmplId: templateId, msg: message, reserveDt: '00000000000000', }, ], { headers: { 'Content-Type': 'application/json;charset=UTF-8', userid: process.env.BIZM_USER_ID, Accept: 'application/json', }, }, ); } }
위의 BizmService를 필요한 Controller.ts에서 import 해서 사용하면 된다.
* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.
Bizm(비즈엠)을 활용한 알림톡 구현
알림톡을 추가할 때, 카카오 비즈니스를 통해 직접하는 것보다 Bizm이라는 알림톡 대행 서비스를 사용하는 것이 편리하다.
비즈엠 - 카카오톡 비즈메시지 공식딜러사
알림톡 친구톡 싸고 편하게 전송
www.bizmsg.kr
Bizm 가이드를 따라면, 프로필과 userid 값을 받을 수 있다.
// bizm.service.ts @Injectable() export class BizmService { async sendMessage(phone: string, templateId: string, message: string) { return axios.post( 'https://alimtalk-api.bizmsg.kr/v2/sender/send', [ { message_type: 'at', phn: '82' + Number(phone), profile: process.env.BIZM_PROFILE, tmplId: templateId, msg: message, reserveDt: '00000000000000', }, ], { headers: { 'Content-Type': 'application/json;charset=UTF-8', userid: process.env.BIZM_USER_ID, Accept: 'application/json', }, }, ); } }
위의 BizmService를 필요한 Controller.ts에서 import 해서 사용하면 된다.
'개발 > NestJS' 카테고리의 다른 글