Posting an image with slack API
<p>I'm attempting to post an image w/the slack API. I have two APIs open (using python) currently, which is rtm &amp; slackbot.</p>

<pre><code>sc = SlackClient(API_KEY)
sc.api_call('chat.postMessages', channel=, text=) #post as bot

sc.rtm_connect():
sc.rtm_send_message(channel=..., message=...) #post as desired user
</code></pre>

<p>These examples work fine to post <em>text</em> to the channel, but I need to post an image to the channel. </p>

<p>I want to post an image using the rtm_* method, but I can't figure out how. The only reference I see for images is <a href="https://api.slack.com/docs/attachments" rel="noreferrer">https://api.slack.com/docs/attachments</a> but I don't see a way to do it w/the rtm API. </p>

<p>Any help is appreciated. TIA. </p>

<p><strong>UPDATE/EDIT</strong>:</p>

<p>So I tried using the method <code>Jon</code> recommended, which is this:</p>

<pre><code>sc.api_call("chat.postMessage", channel='D0K7P9MCJ', text='postMessage test',
            attachments='[{"image_url":"http://i.ytimg.com/vi/tntOCGkgt98/maxresdefault.jpg"}]')
</code></pre>

<p>But that doesn't appear to work (no image is posted) and no error is thrown. </p>

<p><strong>SOLUTION</strong></p>

<p>I got this working by including a title in the attachments section. Wish it threw an error, =/</p>