Created
March 19, 2016 21:41
-
-
Save mikeyk/117d70c0adcf3ec025c6 to your computer and use it in GitHub Desktop.
Amazon Echo>OmniFocus email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import json | |
import boto3 | |
ses_client = boto3.client('ses') | |
TARGET = "mike" | |
EMAILS = { | |
"kaitlyn": "", | |
"mike": "[email protected]" | |
} | |
def send_email(to_email, task_text): | |
response = ses_client.send_email( | |
Source='[email protected]', | |
Destination={ | |
'ToAddresses': [ | |
to_email | |
], | |
}, | |
Message={ | |
'Subject': { | |
'Data': task_text, | |
}, | |
'Body': { | |
'Text': { | |
'Data': "" | |
} | |
} | |
} | |
) | |
def read_from_echo(event, *args, **kwargs): | |
slots = event["request"]["intent"]["slots"] | |
task_text = slots["TaskText"]["value"].capitalize() | |
send_email(EMAILS[TARGET], task_text) | |
response = { | |
"version": "1.0", | |
"sessionAttributes": {}, | |
"response": { | |
"outputSpeech": { | |
"type": "PlainText", | |
"text": "Done." | |
}, | |
"shouldEndSession": True | |
} | |
} | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment