问题描述
根据CLevertap电子邮件通知api的文档页面,我可以在使用此有效负载时发送通知:
payload ='{"to": { "Email": ["ex@gmail.com"],"Identity": ["20171220"]},"tag_group": "Email","respect_frequency_caps": false,"content": {"subject": "Welcome","body": "%s","sender_name": "CLeverTap"}}'%(html_body)
其中html_body = "<div>Your HTML content for the email</div>"
html_body = """<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<table align="center" border="0" cellpadding="0" cellspacing="0" style="text-align:center;" width="620">
<tbody>
<tr>
<td align="center" style="background: #fff;" valign="top">
<a href="#" style="display: block;width: 100%;font-family:'Open Sans',Sans serif,'Arial';" target="_blank"><img alt="An offer" src="http://web.aaa.com/aaa/econnect/aaaa/images/02.jpg" style="width: 100%; display: block; vertical-align: top;"></a>
</td>
</tr>
<tr> </body> </html>"""
使用 python POST请求
时出现此错误url = "https://in1.api.cLevertap.com/1/send/email.json"
#call CLevertap API
response = requests.request("POST",url,headers=headers,data = payload)
response_text = response.text.encode('utf8')
print(response_text)
错误:
b'{ "status" : "fail","error" : "Invalid JSON payload","code" : 78}'
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)