Created
April 17, 2019 15:17
-
-
Save ejdoh1/fde1a611e0ab4de2f32a6beba30a44f0 to your computer and use it in GitHub Desktop.
AWS Pinpoint update_apns_sandbox_channel
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
# First export your APNS P12 cert from the Keychain Access app on your mac | |
# Keychain Access > Certificates > Select cert > right-click > Export as .p12 (passwd optional) | |
# Extract the cert and key from the p12 to use in the pinpoint calls | |
# openssl pkcs12 -in Certificates.p12 -out filename.key -nodes -nocerts | |
# openssl pkcs12 -in Certificates.p12 -clcerts -nokeys -out filename.crt | |
import boto3 | |
APP_ID = "replace with Pinpoint App ID" | |
pp = boto3.client('pinpoint',region_name='us-west-2') | |
r = pp.update_apns_sandbox_channel( | |
APNSSandboxChannelRequest={ | |
'Certificate': open("filename.crt").read(), | |
'DefaultAuthenticationMethod': 'CERTIFICATE', | |
'Enabled': True, | |
'PrivateKey': open("filename.key").read() | |
}, | |
ApplicationId=APP_ID | |
) | |
print r | |
# check is set | |
r = pp.get_apns_sandbox_channel(ApplicationId=APP_ID) | |
print r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment