Skip to content

Commit 243da70

Browse files
committed
알림톡, 친구톡 예제 추가
1 parent 37858df commit 243da70

4 files changed

Lines changed: 147 additions & 0 deletions

File tree

simple/send_one_alimtalk.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import requests
2+
import json
3+
import sys
4+
import os.path
5+
6+
sys.path.append('../')
7+
8+
from auth import auth
9+
import config
10+
11+
# 알림톡 단건 발송
12+
if __name__ == '__main__':
13+
data = {
14+
'message': {
15+
'to': '수신번호 입력',
16+
'from': '발신번호 입력',
17+
'text': '홍길동님 가입을 환영합니다.',
18+
'kakaoOptions': {
19+
'pfId': 'KA01PF200323182344986oTFz9CIabcx', # PFID 입력
20+
'templateId': 'KA01TP200323182345741y9yF20aabcx' # 템플릿아이디 입력
21+
}
22+
}
23+
}
24+
res = requests.post(config.getUrl('/messages/v4/send'), headers=auth.get_headers(config.apiKey, config.apiSecret), json=data)
25+
print(json.dumps(json.loads(res.text), indent=2, ensure_ascii=False))

simple/send_one_alimtalk_button.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import requests
2+
import json
3+
import sys
4+
import os.path
5+
6+
sys.path.append('../')
7+
8+
from auth import auth
9+
import config
10+
11+
# 알림톡(버튼) 단건 발송
12+
if __name__ == '__main__':
13+
data = {
14+
'message': {
15+
'to': '수신번호 입력',
16+
'from': '발신번호 입력',
17+
'text': '홍길동님 가입을 환영합니다.',
18+
'kakaoOptions': {
19+
'pfId': 'KA01PF200323182344986oTFz9CIabcx', # PFID 입력
20+
'templateId': 'KA01TP200323182345741y9yF20aabcx', # 템플릿아이디 입력
21+
'buttons': [
22+
{
23+
'buttonType': 'WL',
24+
'buttonName': '버튼 이름',
25+
'linkMo': 'https://example.com',
26+
'linkPc': 'https://example.com'
27+
},
28+
{
29+
'buttonType': 'AL',
30+
'buttonName': '앱실행',
31+
'linkAnd': 'examplescheme://path', # 안드로이드
32+
'linkIos': 'examplescheme://path' # iOS
33+
},
34+
{
35+
'buttonType': 'DS',
36+
'buttonName': '배송조회'
37+
},
38+
{
39+
'buttonType': 'BK', # 챗봇에게 키워드를 전달합니다. 버튼이름의 키워드가 그대로 전달됩니다.
40+
'buttonName': '봇키워드'
41+
},
42+
{
43+
'buttonType': 'MD', # 상담요청하기 버튼을 누르면 수신 받은 알림톡 메시지가 상담원에게 그대로 전달됩니다.
44+
'buttonName': '상담요청하기'
45+
}
46+
]
47+
}
48+
}
49+
}
50+
res = requests.post(config.getUrl('/messages/v4/send'), headers=auth.get_headers(config.apiKey, config.apiSecret), json=data)
51+
print(json.dumps(json.loads(res.text), indent=2, ensure_ascii=False))

simple/send_one_chingutalk.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import requests
2+
import json
3+
import sys
4+
import os.path
5+
6+
sys.path.append('../')
7+
8+
from auth import auth
9+
import config
10+
11+
# 친구톡 단건 발송
12+
if __name__ == '__main__':
13+
data = {
14+
'message': {
15+
'to': '수신번호 입력',
16+
'from': '발신번호 입력',
17+
'text': '광고를 포함하여 어떤 내용이든 제한없이 발송 가능합니다.',
18+
'kakaoOptions': {
19+
'pfId': 'KA01PF200323182344986oTFz9CIabcx' # PFID 입력
20+
}
21+
}
22+
}
23+
res = requests.post(config.getUrl('/messages/v4/send'), headers=auth.get_headers(config.apiKey, config.apiSecret), json=data)
24+
print(json.dumps(json.loads(res.text), indent=2, ensure_ascii=False))
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import requests
2+
import json
3+
import sys
4+
import os.path
5+
6+
sys.path.append('../')
7+
8+
from auth import auth
9+
import config
10+
11+
# 친구톡(버튼) 단건 발송
12+
# 버튼은 총 5개까지 입력 가능
13+
if __name__ == '__main__':
14+
data = {
15+
'message': {
16+
'to': '수신번호 입력',
17+
'from': '발신번호 입력',
18+
'text': '광고를 포함하여 어떤 내용이든 제한없이 발송 가능합니다.',
19+
'kakaoOptions': {
20+
'pfId': 'KA01PF200323182344986oTFz9CIabcx', # PFID 입력
21+
'buttons': [
22+
{
23+
'buttonType': 'WL',
24+
'buttonName': '버튼 이름',
25+
'linkMo': 'https://example.com',
26+
'linkPc': 'https://example.com'
27+
},
28+
{
29+
'buttonType': 'AL',
30+
'buttonName': '앱실행',
31+
'linkAnd': 'examplescheme://path', # 안드로이드
32+
'linkIos': 'examplescheme://path' # iOS
33+
},
34+
{
35+
'buttonType': 'BK', # 챗봇에게 키워드를 전달합니다. 버튼이름의 키워드가 그대로 전달됩니다.
36+
'buttonName': '봇키워드'
37+
},
38+
{
39+
'buttonType': 'MD', # 상담요청하기 버튼을 누르면 수신 받은 알림톡 메시지가 상담원에게 그대로 전달됩니다.
40+
'buttonName': '상담요청하기'
41+
}
42+
]
43+
}
44+
}
45+
}
46+
res = requests.post(config.getUrl('/messages/v4/send'), headers=auth.get_headers(config.apiKey, config.apiSecret), json=data)
47+
print(json.dumps(json.loads(res.text), indent=2, ensure_ascii=False))

0 commit comments

Comments
 (0)