Python-Slack Integration

The Engagement 4Cast

Python-Slack Integration




Grant Commodore

This step by step guide will show you how to integrate slack with Python. 

Integrating Slack with Python

import sys def send_message_to_slack(text):
    from urllib import request, parse
    import json
    post = {"text": "{0}".format(text)}
        json_data = json.dumps(post)
        req = request.Request("Your Slack URL goes here",
                              headers={'Content-Type': 'application/json'})
        resp = request.urlopen(req)
    except Exception as em:
        print("EXCEPTION: " + str(em)) if len(sys.argv) < 1:
    print("you did not give any argumentsn")
About the Engagement 4Cast

4Site Interactive Studios is a talented troupe of web professionals who are passionate about creating tools to support digital marketers. We love to hear from our community! Reach out to us with your thoughts and questions. And don’t forget to subscribe below to get notified when we post new blogs – no spam, just content👍🏼

Subscribe & stay ahead of the crowd with sage marketing tips and predictions.