0
ソーシャルメディア用の共有ボタンを追加したいと思います。私はスラックのワークフローボタンが機能しているのですが、メッセージペイロードを受け取った人は、受け取っているものを共有できるようにしたいと思います。これまでに私が得たことがここにあります。Python 2.7のSlack APIペイロードにTwitter共有ボタンを追加する方法はありますか?
def post_summary_to_slack(self):
data = str(
{'text': self.summary_printout,
'attachments': [
{
"fallback": "Was this a good use of time and money?",
"title": "Was this a good use of time and money?",
"callback_id": "meetings_survey",
"color": "#800080",
"attachment_type": "default",
"actions": [
{
"name": "yes",
"text": "Yes",
"type": "button",
"value": "yes"
},
{
"name": "no",
"text": "No",
"type": "button",
"value": "no"
},
{
"name": "maybe",
"text": "I'm Not Sure",
"type": "button",
"value": "maybe"
},
/* maybe here:*/
{
"name": "twitter",
"text": "Tweet",
"type": "button",
"value": "Here are the results from the latest analysis"
}
]
}
]
}
)
url = self.SLACK_HOOK
req = urllib2.Request(url, data, {'Content-Type': 'application/json'})
f = urllib2.urlopen(req)
f.close()
誰もがこのようなことを試みましたか?助けてくれてありがとう!