Can I send richly-formatted Slack messages as a Bot and not as a Webhook?
<p>I started writing a Slack bot in Python and came to a halt when I couldn't find a way to send richly-formatted messages using the either of the two methods:</p>

<pre><code>sc.rtm_send_message("channel_name", my_message)

sc.api_call("chat.postMessage", channel="channel_name", text=my_message, username="username", icon_url="icon_url")
</code></pre>

<p>where <code>my_message = json.dumps({'attachments': [{...}]})</code></p>

<p>I now know that I can do this using the webhook approach but is it possible with the above method?</p>

<p>I found out where I was going wrong.</p>

<p>I was passing my message to the wrong argument in the <code>sc.api_call</code> method.</p>

<p>I should've been passing it to <code>sc.api_call(</code><strong><code>attachments=</code></strong><code>...)</code> argument, not the <code>text</code> argument.</p>

python slack-api slack