Menu

Expand
Rate this page:

Credential Resource

The Credential resource represents one credential record for a specific push notifications channel. Twilio Conversations supports the APNS, FCM, and GCM push notification channels. Each push notification channel vendor issues its own Credentials, and they can vary between vendors. The Credential resource allows you to save the Credentials that should be used for push notifications to a specific channel.

Credential properties

The Credential resource contains these properties:

Resource Properties in REST API format
sid
sid<CR> Not PII

A 34 character string that uniquely identifies this resource.

account_sid
sid<AC> Not PII

The unique ID of the Account responsible for this credential.

friendly_name

The human-readable name of this credential, limited to 64 characters. Optional.

type
enum:push_type Not PII

The type of push-notification service the credential is for. Can be: fcm, gcm, or apn.

sandbox
string Not PII

[APN only] Whether to send the credential to sandbox APNs. Can be true to send to sandbox APNs or false to send to production.

date_created
date_time<iso8601> Not PII

The date that this resource was created.

date_updated
date_time<iso8601> Not PII

The date that this resource was last updated.

url
url Not PII

An absolute API resource URL for this credential.

Create a Credential resource

post
https://conversations.twilio.com/v1/Credentials
Parameters
Parameters in REST API format
type
Required
post ienum:push_type Not PII

The type of push-notification service the credential is for. Can be: fcm, gcm, or apn.

friendly_name
Optional
post string PII MTL: 30 DAYS

A descriptive string that you create to describe the new resource. It can be up to 64 characters long.

certificate
Optional
post string Not PII

[APN only] The URL encoded representation of the certificate. For example, -----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----.

private_key
Optional
post string Not PII

[APN only] The URL encoded representation of the private key. For example, -----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----.

sandbox
Optional
post boolean Not PII

[APN only] Whether to send the credential to sandbox APNs. Can be true to send to sandbox APNs or false to send to production.

api_key
Optional
post string Not PII

[GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential.

secret
Optional
post string Not PII

[FCM only] The Server key of your project from the Firebase console, found under Settings / Cloud messaging.

Example 1
Loading Code Sample...
        
        

        Create Credential

        Fetch a Credential resource

        get
        https://conversations.twilio.com/v1/Credentials/{Sid}
        Parameters
        Parameters in REST API format
        sid
        Path
        get sid<CR> Not PII

        A 34 character string that uniquely identifies this resource.

        Example 1
        Loading Code Sample...
              
              

              Fetch Credential

              Read multiple Credential resources

              get
              https://conversations.twilio.com/v1/Credentials
              Example 1
              Loading Code Sample...
                    
                    

                    Read Credential

                    Update a Credential resource

                    post
                    https://conversations.twilio.com/v1/Credentials/{Sid}
                    Parameters
                    Parameters in REST API format
                    sid
                    Path
                    post sid<CR> Not PII

                    A 34 character string that uniquely identifies this resource.

                    type
                    Optional
                    post ienum:push_type Not PII

                    The type of push-notification service the credential is for. Can be: fcm, gcm, or apn.

                    friendly_name
                    Optional
                    post string PII MTL: 30 DAYS

                    A descriptive string that you create to describe the new resource. It can be up to 64 characters long.

                    certificate
                    Optional
                    post string Not PII

                    [APN only] The URL encoded representation of the certificate. For example, -----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----.

                    private_key
                    Optional
                    post string Not PII

                    [APN only] The URL encoded representation of the private key. For example, -----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----.

                    sandbox
                    Optional
                    post boolean Not PII

                    [APN only] Whether to send the credential to sandbox APNs. Can be true to send to sandbox APNs or false to send to production.

                    api_key
                    Optional
                    post string Not PII

                    [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential.

                    secret
                    Optional
                    post string Not PII

                    [FCM only] The Server key of your project from the Firebase console, found under Settings / Cloud messaging.

                    Example 1
                    Loading Code Sample...
                          
                          

                          Update Credential

                          Delete a Credential resource

                          delete
                          https://conversations.twilio.com/v1/Credentials/{Sid}
                          Parameters
                          Parameters in REST API format
                          sid
                          Path
                          delete sid<CR> Not PII

                          A 34 character string that uniquely identifies this resource.

                          Example 1
                          Loading Code Sample...
                                
                                

                                Delete Credential

                                Rate this page:

                                Need some help?

                                We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                Loading Code Sample...
                                      
                                      
                                      

                                      Thank you for your feedback!

                                      Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                      Sending your feedback...
                                      🎉 Thank you for your feedback!
                                      Something went wrong. Please try again.

                                      Thanks for your feedback!

                                      thanks-feedback-gif