# [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E8%90%A5%E9%94%80%E8%83%BD%E5%8A%9B-marketing)營銷能力 Marketing
## [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E7%94%9F%E6%B4%BB%E5%8F%B7-openlife)生活號 OpenLife
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E5%88%9B%E5%BB%BA%E5%9B%BE%E6%96%87%E6%B6%88%E6%81%AF%E5%86%85%E5%AE%B9)創建圖文消息內容
* API聲明
createImageTextContent(title: string, cover: string, content: string, contentComment: string, ctype: string, benefit: string, extTags: string, loginIds: string)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| title | string | 是 | 標題 |
| cover | string | 是 | 封面圖URL, 尺寸為996\*450,最大不超過3M,支持.jpg、.png格式,請先調用上傳圖片接口獲得圖片URL |
| content | string | 是 | 消息正文(支持富文本) |
| contentComment | string | 否 | 是否允許評論,T:允許,F:不允許,默認不允許 |
| ctype | string | 否 | 圖文類型:填activity表示活動圖文,不填默認普通圖文 |
| benefit | string | 否 | 活動利益點,圖文類型ctype為activity類型時才需要傳,最多10個字符 |
| extTags | string | 否 | 關鍵詞列表,英文逗號分隔,最多不超過5個 |
| loginIds | string | 否 | 可預覽支付寶賬號列表,需要預覽時才填寫, 英文逗號分隔,最多不超過10個 |
* 出參說明
可前往[alipay.open.public.message.content.create](https://docs.open.alipay.com/api_6/alipay.open.public.message.content.create)查看更加詳細的參數說明。
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E6%9B%B4%E6%96%B0%E5%9B%BE%E6%96%87%E6%B6%88%E6%81%AF%E5%86%85%E5%AE%B9)更新圖文消息內容
* API聲明
modifyImageTextContent(contentId: string, title: string, cover: string, content: string, couldComment: string, ctype: string, benefit: string, extTags: string, loginIds: string)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| contentId | string | 是 | 內容ID,通過創建圖文內容消息接口返回 |
| title | string | 是 | 標題 |
| cover | string | 是 | 封面圖URL, 尺寸為996\*450,最大不超過3M,支持.jpg、.png格式,請先調用上傳圖片接口獲得圖片URL |
| content | string | 是 | 消息正文(支持富文本) |
| contentComment | string | 否 | 是否允許評論,T:允許,F:不允許,默認不允許 |
| ctype | string | 否 | 圖文類型:填activity表示活動圖文,不填默認普通圖文 |
| benefit | string | 否 | 活動利益點,圖文類型ctype為activity類型時才需要傳,最多10個字符 |
| extTags | string | 否 | 關鍵詞列表,英文逗號分隔,最多不超過5個 |
| loginIds | string | 否 | 可預覽支付寶賬號列表,需要預覽時才填寫, 英文逗號分隔,最多不超過10個 |
* 出參說明
可前往[alipay.open.public.message.content.modify](https://docs.open.alipay.com/api_6/alipay.open.public.message.content.modify)查看更加詳細的參數說明。
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E7%BE%A4%E5%8F%91%E6%9C%AC%E6%96%87%E6%B6%88%E6%81%AF)群發本文消息
* API聲明
sendText(text: string)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| text | string | 是 | 文本消息內容 |
* 出參說明
可前往[alipay.open.public.message.total.send](https://docs.open.alipay.com/api_6/alipay.open.public.message.total.send)查看更加詳細的參數說明。
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E7%BE%A4%E5%8F%91%E5%9B%BE%E6%96%87%E6%B6%88%E6%81%AF)群發圖文消息
* API聲明
sendImageText(articles: \[ Article \])
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| articles | Article數組 | 是 | 圖文消息內容 |
Article對象說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| title | string | 否 | 圖文消息標題 |
| desc | string | 是 | 圖文消息描述 |
| imageUrl | string | 特殊可選 | 圖片鏈接,對于多條圖文消息的第一條消息,該字段不能為空,請先調用上傳圖片接口獲得圖片URL |
| url | string | 是 | 點擊圖文消息跳轉的鏈接 |
| actionName | string | 否 | 鏈接文字 |
* 出參說明
可前往[alipay.open.public.message.total.send](https://docs.open.alipay.com/api_6/alipay.open.public.message.total.send)查看更加詳細的參數說明。
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E5%8D%95%E5%8F%91%E6%A8%A1%E6%9D%BF%E6%B6%88%E6%81%AF)單發模板消息
* API聲明
sendSingleMessage(toUserId: string, template: Template)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| toUserId | string | 是 | 消息接收用戶的UserId |
| template | Template | 是 | 消息接收用戶的UserId |
Template對象說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| templateId | string | 是 | 消息模板ID |
| context | Context | 是 | 消息模板上下文,即模板中定義的參數及參數值 |
Context對象說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| headColor | string | 是 | 頂部色條的色值,比如#85be53 |
| url | string | 是 | 點擊消息后承接頁的地址 |
| actionName | string | 是 | 底部鏈接描述文字,如:“查看詳情”,最多能傳8個漢字或16個英文字符 |
| keyword1 | Keyword | 否 | 模板中占位符的值及文字顏色 |
| keyword2 | Keyword | 否 | 模板中占位符的值及文字顏色 |
| first | Keyword | 否 | 模板中占位符的值及文字顏色 |
| remark | Keyword | 否 | 模板中占位符的值及文字顏色 |
Keyword對象說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| color | string | 是 | 當前文字顏色,比如#85be53 |
| value | string | 是 | 模板中占位符的值 |
* 出參說明
可前往[alipay.open.public.message.single.send](https://docs.open.alipay.com/api_6/alipay.open.public.message.single.send)查看更加詳細的參數說明。
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E7%94%9F%E6%B4%BB%E5%8F%B7%E6%B6%88%E6%81%AF%E6%92%A4%E5%9B%9E)生活號消息撤回
* API聲明
recallMessage(messageId: string)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| messageId | string | 是 | 消息ID |
* 出參說明
可前往[alipay.open.public.life.msg.recall](https://docs.open.alipay.com/api_6/alipay.open.public.life.msg.recall)查看更加詳細的參數說明。
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E6%A8%A1%E6%9D%BF%E6%B6%88%E6%81%AF%E8%A1%8C%E4%B8%9A%E8%AE%BE%E7%BD%AE)模板消息行業設置
* API聲明
setIndustry(primaryIndustryCode: string, primaryIndustryName: string, secondaryIndustryCode: string, secondaryIndustryName: string)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| primaryIndustryCode | string | 是 | 服務窗消息模板所屬主行業一級編碼,查看[行業信息](https://alipay.open.taobao.com/doc2/detail?treeId=197&docType=1&articleId=105043) |
| primaryIndustryName | string | 是 | 服務窗消息模板所屬主行業一級名稱 |
| secondaryIndustryCode | string | 是 | 服務窗消息模板所屬主行業二級編碼 |
| secondaryIndustryName | string | 是 | 服務窗消息模板所屬主行業二級名稱 |
* 出參說明
可前往[alipay.open.public.template.message.industry.modify](https://docs.open.alipay.com/api_6/alipay.open.public.template.message.industry.modify)查看更加詳細的參數說明。
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E7%94%9F%E6%B4%BB%E5%8F%B7%E6%9F%A5%E8%AF%A2%E8%A1%8C%E4%B8%9A%E8%AE%BE%E7%BD%AE)生活號查詢行業設置
* API聲明
getIndustry()
* 入參說明
無
* 出參說明
可前往[alipay.open.public.setting.category.query](https://docs.open.alipay.com/api_6/alipay.open.public.setting.category.query)查看更加詳細的參數說明。
* * *
## [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E6%94%AF%E4%BB%98%E5%AE%9D%E5%8D%A1%E5%8C%85-pass)支付寶卡包 Pass
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E5%8D%A1%E5%88%B8%E6%A8%A1%E6%9D%BF%E5%88%9B%E5%BB%BA)卡券模板創建
* API聲明
createTemplate(uniqueId: string, tplContent: string)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| uniqueId | string | 是 | 商戶用于控制模版的唯一性(可以使用時間戳保證唯一性) |
| tplContent | string | 是 | 模板內容信息,遵循JSON規范,詳情參見tpl\_content[參數說明](https://doc.open.alipay.com/doc2/detail.htm?treeId=193&articleId=105249&docType=1#tpl_content) |
* 出參說明
可前往[alipay.pass.template.add](https://docs.open.alipay.com/api_24/alipay.pass.template.add)查看更加詳細的參數說明。
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E5%8D%A1%E5%88%B8%E6%A8%A1%E6%9D%BF%E6%9B%B4%E6%96%B0)卡券模板更新
* API聲明
updateTemplate(uniqueId: string, tplContent: string)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| uniqueId | string | 是 | 商戶用于控制模版的唯一性(可以使用時間戳保證唯一性) |
| tplContent | string | 是 | 模板內容信息,遵循JSON規范,詳情參見tpl\_content[參數說明](https://doc.open.alipay.com/doc2/detail.htm?treeId=193&articleId=105249&docType=1#tpl_content) |
* 出參說明
可前往[alipay.pass.template.update](https://docs.open.alipay.com/api_24/alipay.pass.template.update)查看更加詳細的參數說明。
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E5%8D%A1%E5%88%B8%E5%AE%9E%E4%BE%8B%E5%8F%91%E6%94%BE)卡券實例發放
* API聲明
addInstance(tplId: string, tplParams: string, recognitionType: string, recognitionInfo: string)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| tplId | string | 是 | 支付寶pass模版ID,即調用模板創建接口時返回的tpl\_id |
| tplParams | string | 是 | 模版動態參數信息,對應模板中$變量名$的動態參數,見模板創建接口返回值中的tpl\_params字段。示例: |
| recognitionType | string | 是 | Alipass添加對象識別類型,填寫“1”表示訂單信息 |
| recognitionInfo | string | 是 | 支付寶用戶識別信息,參見[UID發券組件對接文檔](https://docs.open.alipay.com/199/sy3hs4) |
* 出參說明
可前往[alipay.pass.instance.add](https://docs.open.alipay.com/api_24/alipay.pass.instance.add)查看更加詳細的參數說明。
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E5%8D%A1%E5%88%B8%E5%AE%9E%E4%BE%8B%E6%9B%B4%E6%96%B0)卡券實例更新
* API聲明
updateInstance(serialNumber: string, channelId: string, tplParams: string, status: string, verifyCode: string, verifyType: string)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| serialNumber | string | 是 | 商戶指定卡券唯一值,卡券JSON模板中fileInfo->serialNumber字段對應的值 |
| channelId | string | 是 | 代理商代替商戶發放卡券后,再代替商戶更新卡券時,此值為商戶的PID/AppID |
| tplParams | string | 否 | Alipass添加對象識別類型,填寫“1”表示訂單信息 |
| status | string | 否 | 券狀態,支持更新為USED、CLOSED兩種狀態 |
| verifyCode | string | 否 | 核銷碼串值(當狀態變更為USED時,建議傳),該值正常為模板中核銷區域(Operation)對應的message值 |
| verifyType | string | 否 | 核銷方式,該值正常為模板中核銷區域(Operation)對應的format值,verifyCode和verifyType需同時傳入 |
* 出參說明
可前往[alipay.pass.instance.update](https://docs.open.alipay.com/api_24/alipay.pass.instance.update)查看更加詳細的參數說明。
* * *
## [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E5%B0%8F%E7%A8%8B%E5%BA%8F%E6%A8%A1%E6%9D%BF%E6%B6%88%E6%81%AF-templatemessage)小程序模板消息 TemplateMessage
### [](https://github.com/alipay/alipay-easysdk/blob/master/APIDoc.md#%E5%8F%91%E9%80%81%E6%A8%A1%E6%9D%BF%E6%B6%88%E6%81%AF)發送模板消息
* API聲明
send(toUserId: string, formId: string, userTemplateId: string, page: string, data: string)
* 入參說明
| 字段名 | 類型 | 必填 | 說明 |
| --- | --- | --- | --- |
| toUserId | string | 是 | 發送消息的支付寶賬號 |
| formId | string | 是 | 用戶發生的交易行為的交易號,或者用戶在小程序產生表單提交的表單號,用于信息發送的校驗 |
| userTemplateId | string | 是 | 用戶申請的模板id號,固定的模板id會發送固定的消息 |
| page | string | 是 | 小程序的跳轉頁面,用于消息中心用戶點擊之后詳細跳轉的小程序頁面,例如:page/component/index |
| data | string | 是 | 開發者需要發送模板消息中的自定義部分來替換模板的占位符,例如:{"keyword1": {"value" : "12:00"},"keyword2": {"value" : "20180808"},"keyword3": {"value" : "支付寶"}} |
* 出參說明
可前往[alipay.open.app.mini.templatemessage.send](https://docs.open.alipay.com/api_5/alipay.open.app.mini.templatemessage.send)查看更加詳細的參數說明。
* * *