ruanbekker
8/2/2017 - 11:06 PM

Invoke Rocketchat Incoming Webhook with Python

Invoke Rocketchat Incoming Webhook with Python

import requests
import json

uri = 'https://domain.com/hooks/1234AbcD'
data={}
data = {
    "username": "Python Bot",
    "icon_emoji": ":whale:",
    "attachments": [
        {
            "title": "Docker Release Notes",
            "title_link": "https://docs.docker.com/release-notes/docker-ce/",
            "text": "Docer CE Release Notes Information",
            "image_url": "https://storage.googleapis.com/static.ianlewis.org/prod/img/docker/large_v-trans.png",
            "color":"#764FA5"
        }
    ]
}

r = requests.post(uri, json.dumps(data)).content
print(r)