[TIL] 08.11 카카오 메시지 템플릿
2020. 8. 11. 22:04ㆍTIL
카카오 템플릿 생성은 카카오 개발자에 페이지에 가서 도구 메뉴를 클릭한 후 메시지 템플릿에 들어가면 템플릿을 만들 수 있다.
자세한 설정은 아래 링크로 들어가보면 잘 나와 있다.
https://developers.kakao.com/sdk/reference/js/release/Kakao.Link.html#.sendCustom__anchor
https://developers.kakao.com/docs/latest/ko/message/js#link-send-with-template-id
// 페이지 진입 시 kakao initialize
useEffect(() => window.Kakao.init(process.env.KAKAO_API_KEY, []);
// 템플릿 객체 생성 카카오 개발자에서 생성한 템플릿Id 를 적어 준다
// templateArgs 값을 이용하여 동적인 값을 넘겨 줄 수 있다.
const template = {
templateId: 34182,
templateArgs: {
'vitamintest_id': `${id}`
}
};
// custom한 메시지이기 때문에 sendCustom 함수를 사용하여 메시지를 보내준다.
window.Kakao.Link.sendCustom(template);
'TIL' 카테고리의 다른 글
[TIL] 08.31 Next.js sass "attribute starts with" error (0) | 2020.08.31 |
---|---|
[TIL] 08.19 Next.js getStaticProps and getServerSideProps (0) | 2020.08.19 |
[TIL] 08.07 (0) | 2020.08.07 |
[TIL] 08.06 next tsconfig absolute path (0) | 2020.08.06 |
[TIL] 08.05 next dinamic route (0) | 2020.08.05 |