有没有办法在Python2.7中向SlackAPI负载添加Twitter共享按钮?
我想为社交媒体添加一个共享按钮。我已经让松弛的工作流按钮工作,但我希望那些接收消息负载的人能够共享他们正在接收的内容。这是我到目前为止得到的有没有办法在Python2.7中向SlackAPI负载添加Twitter共享按钮?,python,twitter,slack-api,Python,Twitter,Slack Api,我想为社交媒体添加一个共享按钮。我已经让松弛的工作流按钮工作,但我希望那些接收消息负载的人能够共享他们正在接收的内容。这是我到目前为止得到的 def post_summary_to_slack(self): data = str( {'text': self.summary_printout, 'attachments': [ { "fallback": "Was this a
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()
有人试过这样的东西吗?谢谢你的帮助 你肯定能做到。但是,Slack不提供现成的Twitter共享按钮,因此您的脚本需要实现该功能。因此,您的Twitter共享按钮将像调用任何其他消息按钮一样调用您的脚本,并且您的脚本需要通过调用正确的等来将消息内容转发到Twitter