in CBHelper-notify/lambda_function.py [0:0]
def sendNotification(message, originationNumber,destinationNumber,applicationId,region):
messageType = "TRANSACTIONAL"
client = boto3.client('pinpoint',region_name=region)
try:
response = client.send_messages(
ApplicationId=applicationId,
MessageRequest={
'Addresses': {
destinationNumber: {
'ChannelType': 'SMS'
}
},
'MessageConfiguration': {
'SMSMessage': {
'Body': message,
'MessageType': messageType,
'OriginationNumber': originationNumber
}
}
}
)
except ClientError as e:
print(e.response['Error']['Message'])
return None
else:
print("Message sent! Message ID: "
+ response['MessageResponse']['Result'][destinationNumber]['MessageId'])
return response