Skip to content

Instantly share code, notes, and snippets.

@kunal732
Created December 10, 2014 22:27
Show Gist options
  • Select an option

  • Save kunal732/2010308a66746e68bab1 to your computer and use it in GitHub Desktop.

Select an option

Save kunal732/2010308a66746e68bab1 to your computer and use it in GitHub Desktop.
Orchestrate - SendGrid Mashup
from flask import Flask, request
from porc import Client
app = Flask(__name__)
client = Client("your_orchestrate_api+key")
@app.route ('/incoming', methods = ['POST'])
def nextweb():
subject = request.form['subject']
sender = request.form['from']
recip = request.form['to']
body = request.form ['text']
#Store in Orchestrate
response = client.put('email', sender, {
"To": recip,
"Subject": subject,
"Body":body
})
response.raise_for_status()
return "OK"
if __name__ =='__main__':
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment