懒散的帖子只有没有json的文字

时间:2017-09-27 06:59:52

标签: json slack

我尝试发送json来进行冗长的机器人调查,文档https://api.slack.com/methods/chat.postMessage说我需要使用一些方法,按钮应该是附件。我用uri喜欢

https://slack.com/api/chat.postMessage?token=some token&attachments={"text"%3A"В каком ресторане завтра закажем еду%3F"%2C"attachments"%3A[{"text"%3A"Выберете один ресторан"%2C"fallback"%3A"Так нельзя"%2C"color"%3A"%23ff0000"%2C"attachment_type"%3A"default"%2C"actions"%3A[{"name"%3A"cafe"%2C"text"%3A"Adriano"%2C"type"%3A"button"%2C"style"%3A"danger"%2C"value"%3A"Adriano"}%2C{"name"%3A"cafe"%2C"text"%3A"Burger House"%2C"type"%3A"button"%2C"style"%3A"danger"%2C"value"%3A"Burger House"}%2C{"name"%3A"cafe"%2C"text"%3A"Thermonuclear War"%2C"style"%3A"danger"%2C"type"%3A"button"%2C"value"%3A"war"%2C"confirm"%3A{"title"%3A"Are you sure%3F"%2C"text"%3A"Wouldn't you prefer a good game of chess%3F"%2C"ok_text"%3A"Yes"%2C"dismiss_text"%3A"No"}}]}]}&channel=C76JB0KB7&text=“text”

但它只发布文字。我怎么能用民意调查来做好。

1 个答案:

答案 0 :(得分:0)

此版本工作

https://slack.com/api/chat.postMessage?token=xsometokenL&channel=C76JB0KB7&text=В каком ресторане завтра закажем еду%3F&attachments=[{"text"%3A"Выберете один ресторан"%2C"fallback"%3A"Так нельзя"%2C"color"%3A"%23ff0000"%2C"attachment_type"%3A"default"%2C"actions"%3A[{"name"%3A"cafe"%2C"text"%3A"Adriano"%2C"type"%3A"button"%2C"style"%3A"danger"%2C"value"%3A"Adriano"}%2C{"name"%3A"cafe"%2C"text"%3A"Burger House"%2C"type"%3A"button"%2C"style"%3A"danger"%2C"value"%3A"Burger House"}%2C{"name"%3A"cafe"%2C"text"%3A"Thermonuclear War"%2C"style"%3A"danger"%2C"type"%3A"button"%2C"value"%3A"war"%2C"confirm"%3A{"title"%3A"Are you sure%3F"%2C"text"%3A"Wouldn't you prefer a good game of chess%3F"%2C"ok_text"%3A"Yes"%2C"dismiss_text"%3A"No"}}]}]}