简体   繁体   中英

how to create endpoints and send messages in amazon pinpoint

im trying to use boto3 to send messages with pinpoint to, but the functions for update_endpoint and send_messages keeps return me Resource not found

client = boto3.client('pinpoint', region_name="us-east-1", aws_access_key_id="xxx", aws_secret_access_key="xxx")

client.update_endpoint(ApplicationId="xxx",EndpointId='+573163781068',EndpointRequest={'Address': '+573163781068','ChannelType': 'SMS','Location': {'Country': 'CO'}})

client.send_messages(ApplicationId="xxx", MessageRequest={'Addresses': {'+573163781068': {'ChannelType': 'SMS'}}, 'MessageConfiguration': {'SMSMessage': {'Body': 'hola desde libreria', 'MessageType': 'TRANSACTIONAL'}}})

the error that returns me is:

Traceback (most recent call last):
 File "<console>", line 1, in <module>
 File "/Applications/MAMP/htdocs/enviroment/kleanapp/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
 File "/Applications/MAMP/htdocs/enviroment/kleanapp/lib/python3.7/site-packages/botocore/client.py", line 661, in _make_api_call
  raise error_class(parsed_response, operation_name)
botocore.errorfactory.NotFoundException: An error occurred (NotFoundException) when calling the SendMessages operation: Resource not found

in advance thanks for your help

You don't need an endpoint to send a message. Just remove the update_endpoint line.

The NotFoundException can come from the Application ID not being found. Please make sure you are specifying the correct application ID value in the correct region.

You can find a list of valid applications and their IDs for a particular region using the following command:

aws --region us-east-1 pinpoint get-apps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM