I want to send an email from AWS lambda using AWS pinpoint to the end-user using Python.
I was able to get the example from https://docs.aws.amazon.com/pinpoint/latest/developerguide/send-messages-sdk.html to work with just a couple updates to the code.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Pinpoint",
"Effect": "Allow",
"Action": "mobiletargeting:SendMessages",
"Resource": "*"
}
]
}
import boto3
from botocore.exceptions import ClientError
def lambda_handler(event, context):
# The AWS Region that you want to use to send the email. For a list of
# AWS Regions where the Amazon Pinpoint API is available, see
# https://docs.aws.amazon.com/pinpoint/latest/apireference/
AWS_REGION = "us-east-1"
# The "From" address. This address has to be verified in
# Amazon Pinpoint in the region you're using to send email.
[...]
AWS_REGION = [the region you setup your pinpoint and lambda]
SENDER = [your verified email address]
TOADDRESS = [your verified email address]
APPID = [your project id from pinpoint]