1 回答

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超2個(gè)贊
和 elements屬性buttons需要是列表??纯聪旅娴氖纠0?。
var attachment = new
{
type = "template",
payload = new
{
template_type = "generic",
elements = new []
{
new {
title = "title",
image_url = "https://thechangreport.com/img/lightning.png",
subtitle = "subtitle",
buttons = new object[]
{
new {
type = "element_share",
share_contents = new {
attachment = new {
type = "template",
payload = new
{
template_type = "generic",
elements = new []
{
new {
title = "title 2",
image_url = "https://thechangreport.com/img/lightning.png",
subtitle = "subtitle 2",
buttons = new object[]
{
new {
type = "web_url",
url = "http://m.me/petershats?ref=invited_by_24601",
title = "Take Quiz"
},
},
},
},
},
}
},
},
},
},
},
},
};
reply.ChannelData = JObject.FromObject(new { attachment });
share_contents請(qǐng)注意,如果您的主模板與您嘗試共享的模板不同,您只需向模板添加一個(gè)元素。否則,您的按鈕只能是new { type = "element_share" },這使得模板變得不那么復(fù)雜。
此外,請(qǐng)務(wù)必將您的所有 URL列入白名單,并確保所有圖像 URL 都能正常工作——其中有幾個(gè)不能正常工作。如果 URL 未列入白名單且圖像鏈接已損壞,則模板不會(huì)呈現(xiàn)。
- 1 回答
- 0 關(guān)注
- 126 瀏覽
添加回答
舉報(bào)