앱id: 967097
파이썬을 이용중입니다.
다음과 같이 구성하여 커머스템플릿을 전송했는데 전부 잘 넘어오는데 구매하기나 이미지를 클릭하면 모바일에서는 구글플레이 다시시도가 뜨고
컴퓨터에서는 이렇게 뜹니다.
어느 부분이 문제일까요?
import json
import requests
String_title=“바지테스트”
String_iamgeUrl=“https://search.pstatic.net/common/?src=http%3A%2F%2Fshop1.phinf.naver.net%2F20230109_175%2F1673249336495SoEOD_JPEG%2F74385171320187153_1114772885.jpg&type=sc960_832”
String_link=“https://smartstore.naver.com/buy_day/products/7890635454?NaPm=ct%3Dlmk9b10g|ci%3D9dc77516404f0f3666d3a49eaac8fc4868b9d432|tr%3Dimg|sn%3D1110059|hk%3D57d60728aeff688d86d09481daa3a412419a7c10”
url = “https://kapi.kakao.com/v2/api/talk/memo/default/send”
#발행한 토큰 불러오기
with open(“token.json”,“r”) as kakao:
tokens = json.load(kakao)
headers={
“Authorization” : "Bearer " + tokens[“access_token”]
}
template_object={
“object_type”: “commerce”,
“content”: {
“title”: “Ivory long dress (4 Color)”,
“image_url”: “https://mud-kage.kakao.com/dn/RY8ZN/btqgOGzITp3/uCM1x2xu7GNfr7NS9QvEs0/kakaolink40_original.png”,
“image_width”: 640,
“image_height”: 640,
“link”: {
“web_url”: “https://style.kakao.com/main/women/contentId=100”,
“mobile_web_url”: “https://style.kakao.com/main/women/contentId=100”,
“android_execution_params”: “contentId=100”,
“ios_execution_params”: “contentId=100”
}
},
“commerce”: {
“regular_price”: 208800,
“discount_price”: 146160,
“discount_rate”: 30
},
“buttons”: [
{
“title”: “구매하기”,
“link”: {
“web_url”: “https://style.kakao.com/main/women/contentId=100/buy”,
“mobile_web_url”: “https://style.kakao.com/main/women/contentId=100/buy”,
“android_execution_params”: “contentId=100&buy=true”,
“ios_execution_params”: “contentId=100&buy=true”
}
},
{
“title”: “공유하기”,
“link”: {
“web_url”: “https://style.kakao.com/main/women/contentId=100/share”,
“mobile_web_url”: “https://style.kakao.com/main/women/contentId=100/share”,
“android_execution_params”: “contentId=100&share=true”,
“ios_execution_params”: “contentId=100&share=true”
}
}
]
}
data = {
“template_object” : json.dumps(template_object)
}
res = requests.post(url, data=data, headers=headers)
if res.json().get(‘result_code’) == 0:
print(‘메시지를 성공적으로 보냈습니다.’)
else:
print('메시지를 성공적으로 보내지 못했습니다. 오류메시지 : ’ + str(res.json()))