Skip to content

Instantly share code, notes, and snippets.

@looneym
Created February 13, 2017 16:55
Show Gist options
  • Save looneym/dda1ea93fb854ef33f95656937416578 to your computer and use it in GitHub Desktop.
Save looneym/dda1ea93fb854ef33f95656937416578 to your computer and use it in GitHub Desktop.
from slackclient import SlackClient
from flask import Flask, request
# Slack config
BOT_TOKEN = os.environ['BOTKEY']
CHANNEL_NAME = "intercom-event-notifications"
app = Flask(__name__)
@app.route('/', methods=['POST'])
def get_body():
req = request.get_data()
# process the request here and extract whatver info you need for the slack message
message_to_slack(message)
return req
def message_to_slack(message)
sc = SlackClient(BOT_TOKEN)
sc.rtm_connect()
sc.rtm_send_message(CHANNEL_NAME, message )
if __name__ == '__main__':
app.run(debug=True, port=5000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment