os / slacker

Full-featured Python interface for the Slack API
Apache License 2.0
1.6k stars 245 forks source link

chat.post_message() arguments does not match SlackApi arguments #83

Closed Lex45x closed 7 years ago

Lex45x commented 8 years ago

I was faced with next problem: When I try to send message with attachments and without text I'm catching exception But Slack provides sending message with empty text and attachments, as you can see picture below image Hope you fix that:)

tomdownes14 commented 8 years ago

You can provide a string with just a space as the text field, which is then overridden by your attachments. I've done this and had no issues.

nmavor commented 8 years ago

HI i just test it and its not looking as working the code is :

from slacker import Slacker

slack = Slacker(properties.slack_key) MSG = '[{title:"cnn site", title_link:"http://cnn.com"}]' slack.chat.post_message(channel='test',attachments=MSG,text=' ')

i did test full json but its not working in geting clear text in the slack

JWSong commented 8 years ago

You must put a wrong-formatted attachment. If a wrong-formatted attachment sent to API, it is ignored so that the 'text' field is required. Check your attachment format and do not forget set the argument 'text' to None.