Skip to content

Instantly share code, notes, and snippets.

@mikeyk
Created March 19, 2016 21:41
Show Gist options
  • Save mikeyk/117d70c0adcf3ec025c6 to your computer and use it in GitHub Desktop.
Save mikeyk/117d70c0adcf3ec025c6 to your computer and use it in GitHub Desktop.
Amazon Echo>OmniFocus email
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