2017-09-27 28 views
0

我试图发送json来做松散bot bot,文档https://api.slack.com/methods/chat.postMessage说我需要使用一些方法,按钮应该是附件。我使用URI喜欢松懈帖子只有文字没有json

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” 

但只张贴字的文字。我怎么能用民意测验正确地做到这一点。

回答

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"}}]}]}