I'm using Python 2.7 along with a python-slackclient. I have an attachment structure like so:
self.msg = {
"attachments": [
{
"fallback": "%s, %s" % (self.jiraIssueObj.fields.summary, self.link),
"pretext": "Detail summary for %s" % self.jiraIssueObj,
"title": self.jiraIssueObj.fields.summary,
"title_link": self.link,
"text": self.jiraIssueObj.fields.description[0:self.maxSummary],
"color": "#7CD197",
"mrkdwn_in": ["text", "pretext", "fields"]
}
]
}
then,
def Send(self):
if (self.msg):
slack_client.api_call("chat.postMessage", channel=self.channel, text=self.msg, as_user=True)
self.msg = None
However, when this posts, it just posts the plaintext, with no formatting:
{"attachments": [{"title": "Upgrade Grafana to 3.0", "color": "#7CD197 ", "text": "I\u2019ve added the JIRA maillist so this email will create a ticket we can queue it up in support.\u00a0 Eric if you wouldn\u2019t mind just replying to this email with the additional info?\n\n\u00a0\n\n\u00a0\n\nSent: Thursday, August 25, 2016 11:41 AM\n", "title_link": "https://jira.jr.com/browse/ops-164", "mrkdwn_in": ["text", "pretext", "fields"], "pretext": "Detail summary for ops-164", "fallback": "Upgrade Grafana to 3.0, https://jira.jr.com/browse/ops-164"}]}
What am I doing wrong? I've tried also doing attachments=self.msg
in the Send()
call, but I get no output at all to my slack channel when doing that.