Once you've obtained the certificate and private key for iOS (you can follow this guide for that), you can create a new iOS push_credential with the following request:
curl -X "POST" "https://api.telnyx.com/v2/mobile_push_credentials" \
-H 'Authorization: Bearer <my-telnyx-api-key>' \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{
"certificate": "<my-iOS-Certificate>",
"alias": "<my-alias-for-ios-credential>",
"private_key": "<my-iOS-Private-Key>",
"type": "ios"
}'
Similarly for Android, you can follow this guide to obtain a server key and then you can create a new Android push_credential with the following request:
curl -X "POST" "https://api.telnyx.com/v2/mobile_push_credentials" \
-H 'Authorization: Bearer <my-telnyx-api-key>' \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{
"alias": "<my-alias-for-android-credential>",
"type": "android",
"server_key": "<my-Server-Key>"
}'
If you already have some mobile_push_credentials create with Telnyx, you can get information about them with the following requests:
curl "https://api.telnyx.com/v2/mobile_push_credentials" \
-H 'Authorization: Bearer <my-telnyx-api-key>'
Note: we'll need the id
field for a mobile_push_credential, in order to assoicate it with a SIP connection.
If you need new SIP connections, please follow our Portal Setup guide to create them.
Now that we are ready to associate a mobile_push_credentials to a SIP connections.
For an iOS push_credential, you can use the following request:
curl -X "PATCH" "https://api.telnyx.com/v2/credential_connections/<connection_id>" \
-H 'Authorization: Bearer <my-telnyx-api-key>' \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{
"ios_push_credential_id": "<ios_push_credential_id>"
}'
And for Android push_credential:
curl -X "PATCH" "https://api.telnyx.com/v2/credential_connections/<connection_id>" \
-H 'Authorization: Bearer <my-telnyx-api-key>' \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{
"android_push_credential_id": "<android_push_credential_id>"
}'
Note: to get the connection_id, you can visit the SIP Connections page on Portal.