AWS End User Messaging Social

2024/10/10 - AWS End User Messaging Social - 13 new api methods

Changes  This release for AWS End User Messaging includes a public SDK, providing a suite of APIs that enable sending WhatsApp messages to end users.

DisassociateWhatsAppBusinessAccount (new) Link ¶

Disassociate a WhatsApp Business Account (WABA) from your Amazon Web Services account.

See also: AWS API Documentation

Request Syntax

client.disassociate_whatsapp_business_account(
    id='string'
)
type id:

string

param id:

[REQUIRED]

The unique identifier of your WhatsApp Business Account. WABA identifiers are formatted as waba-01234567890123456789012345678901. Use ListLinkedWhatsAppBusinessAccounts to list all WABAs and their details.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

GetLinkedWhatsAppBusinessAccount (new) Link ¶

Get the details of your linked WhatsApp Business Account.

See also: AWS API Documentation

Request Syntax

client.get_linked_whatsapp_business_account(
    id='string'
)
type id:

string

param id:

[REQUIRED]

The unique identifier, from Amazon Web Services, of the linked WhatsApp Business Account. WABA identifiers are formatted as waba-01234567890123456789012345678901. Use ListLinkedWhatsAppBusinessAccounts to list all WABAs and their details.

rtype:

dict

returns:

Response Syntax

{
    'account': {
        'arn': 'string',
        'id': 'string',
        'wabaId': 'string',
        'registrationStatus': 'COMPLETE'|'INCOMPLETE',
        'linkDate': datetime(2015, 1, 1),
        'wabaName': 'string',
        'eventDestinations': [
            {
                'eventDestinationArn': 'string'
            },
        ],
        'phoneNumbers': [
            {
                'arn': 'string',
                'phoneNumber': 'string',
                'phoneNumberId': 'string',
                'metaPhoneNumberId': 'string',
                'displayPhoneNumberName': 'string',
                'displayPhoneNumber': 'string',
                'qualityRating': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • account (dict) --

      The details of the linked WhatsApp Business Account.

      • arn (string) --

        The ARN of the linked WhatsApp Business Account.

      • id (string) --

        The ID of the linked WhatsApp Business Account, formatted as waba-01234567890123456789012345678901.

      • wabaId (string) --

        The WhatsApp Business Account ID from meta.

      • registrationStatus (string) --

        The registration status of the linked WhatsApp Business Account.

      • linkDate (datetime) --

        The date the WhatsApp Business Account was linked.

      • wabaName (string) --

        The name of the linked WhatsApp Business Account.

      • eventDestinations (list) --

        The event destinations for the linked WhatsApp Business Account.

        • (dict) --

          Contains information on the event destination.

          • eventDestinationArn (string) --

            The ARN of the event destination.

      • phoneNumbers (list) --

        The phone numbers associated with the Linked WhatsApp Business Account.

        • (dict) --

          The details of a linked phone number.

          • arn (string) --

            The full Amazon Resource Name (ARN) for the phone number.

          • phoneNumber (string) --

            The phone number associated with the Linked WhatsApp Business Account.

          • phoneNumberId (string) --

            The phone number ID. Phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901.

          • metaPhoneNumberId (string) --

            The phone number ID from Meta.

          • displayPhoneNumberName (string) --

            The display name for this phone number.

          • displayPhoneNumber (string) --

            The phone number that appears in the recipients display.

          • qualityRating (string) --

            The quality rating of the phone number. This is from Meta.

DeleteWhatsAppMessageMedia (new) Link ¶

Delete a media object from the WhatsApp service. If the object is still in an Amazon S3 bucket you should delete it from there too.

See also: AWS API Documentation

Request Syntax

client.delete_whatsapp_media_message(
    mediaId='string',
    originationPhoneNumberId='string'
)
type mediaId:

string

param mediaId:

[REQUIRED]

The unique identifier of the media file to delete. Use the mediaId returned from PostWhatsAppMessageMedia.

type originationPhoneNumberId:

string

param originationPhoneNumberId:

[REQUIRED]

The unique identifier of the originating phone number associated with the media. Phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901. Use GetLinkedWhatsAppBusinessAccount to find a phone number's id.

rtype:

dict

returns:

Response Syntax

{
    'success': True|False
}

Response Structure

  • (dict) --

    • success (boolean) --

      Success indicator for deleting the media file.

AssociateWhatsAppBusinessAccount (new) Link ¶

This is only used through the Amazon Web Services console during sign-up to associate your WhatsApp Business Account to your Amazon Web Services account.

See also: AWS API Documentation

Request Syntax

client.associate_whatsapp_business_account(
    signupCallback={
        'accessToken': 'string'
    },
    setupFinalization={
        'associateInProgressToken': 'string',
        'phoneNumbers': [
            {
                'id': 'string',
                'twoFactorPin': 'string',
                'dataLocalizationRegion': 'string',
                'tags': [
                    {
                        'key': 'string',
                        'value': 'string'
                    },
                ]
            },
        ],
        'phoneNumberParent': 'string',
        'waba': {
            'id': 'string',
            'eventDestinations': [
                {
                    'eventDestinationArn': 'string'
                },
            ],
            'tags': [
                {
                    'key': 'string',
                    'value': 'string'
                },
            ]
        }
    }
)
type signupCallback:

dict

param signupCallback:

Contains the callback access token.

  • accessToken (string) -- [REQUIRED]

    The access token for your WhatsApp Business Account. The accessToken value is provided by Meta.

type setupFinalization:

dict

param setupFinalization:

A JSON object that contains the phone numbers and WhatsApp Business Account to link to your account.

  • associateInProgressToken (string) -- [REQUIRED]

    An Amazon Web Services access token generated by WhatsAppSignupCallback and used by WhatsAppSetupFinalization.

  • phoneNumbers (list) -- [REQUIRED]

    An array of WabaPhoneNumberSetupFinalization objects containing the details of each phone number associated with the WhatsApp Business Account.

    • (dict) --

      The registration details for a linked phone number.

      • id (string) -- [REQUIRED]

        The unique identifier of the originating phone number associated with the media. Phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901. Use GetLinkedWhatsAppBusinessAccount to find a phone number's id.

      • twoFactorPin (string) -- [REQUIRED]

        The PIN to use for two-step verification. To reset your PIN follow the directions in Updating PIN in the WhatsApp Business Platform Cloud API Reference.

      • dataLocalizationRegion (string) --

        The two letter ISO region for the location of where Meta will store data.

        Asia–Pacific (APAC)

        • Australia AU

        • Indonesia ID

        • India IN

        • Japan JP

        • Singapore SG

        • South Korea KR

        Europe

        • Germany DE

        • Switzerland CH

        • United Kingdom GB

        Latin America (LATAM)

        • Brazil BR

        Middle East and Africa (MEA)

        • Bahrain BH

        • South Africa ZA

        • United Arab Emirates AE

        North America (NORAM)

        • Canada CA

      • tags (list) --

        An array of key and value pair tags.

        • (dict) --

          The tag for a resource.

          • key (string) -- [REQUIRED]

            The tag key.

          • value (string) --

            The tag value.

  • phoneNumberParent (string) --

    Used to add a new phone number to an existing WhatsApp Business Account. This field can't be used when the waba field is present.

  • waba (dict) --

    Used to create a new WhatsApp Business Account and add a phone number. This field can't be used when the phoneNumberParent field is present.

    • id (string) --

      The ID of the linked WhatsApp Business Account, formatted as waba-01234567890123456789012345678901.

    • eventDestinations (list) --

      The event destinations for the linked WhatsApp Business Account.

      • (dict) --

        Contains information on the event destination.

        • eventDestinationArn (string) -- [REQUIRED]

          The ARN of the event destination.

    • tags (list) --

      An array of key and value pair tags.

      • (dict) --

        The tag for a resource.

        • key (string) -- [REQUIRED]

          The tag key.

        • value (string) --

          The tag value.

rtype:

dict

returns:

Response Syntax

{
    'signupCallbackResult': {
        'associateInProgressToken': 'string',
        'linkedAccountsWithIncompleteSetup': {
            'string': {
                'accountName': 'string',
                'registrationStatus': 'COMPLETE'|'INCOMPLETE',
                'unregisteredWhatsAppPhoneNumbers': [
                    {
                        'arn': 'string',
                        'phoneNumber': 'string',
                        'phoneNumberId': 'string',
                        'metaPhoneNumberId': 'string',
                        'displayPhoneNumberName': 'string',
                        'displayPhoneNumber': 'string',
                        'qualityRating': 'string'
                    },
                ]
            }
        }
    },
    'statusCode': 123
}

Response Structure

  • (dict) --

    • signupCallbackResult (dict) --

      Contains your WhatsApp registration status.

      • associateInProgressToken (string) --

        An Amazon Web Services access token generated by WhatsAppSignupCallback and used by WhatsAppSetupFinalization.

      • linkedAccountsWithIncompleteSetup (dict) --

        A LinkedWhatsAppBusinessAccountIdMetaData object map containing the details of any WhatsAppBusiness accounts that have incomplete setup.

        • (string) --

          • (dict) --

            Contains your WhatsApp registration status and details of any unregistered WhatsApp phone number.

            • accountName (string) --

              The name of your account.

            • registrationStatus (string) --

              The registration status of the linked WhatsApp Business Account.

            • unregisteredWhatsAppPhoneNumbers (list) --

              The details for unregistered WhatsApp phone numbers.

              • (dict) --

                The details of your WhatsApp phone number.

                • arn (string) --

                  The ARN of the WhatsApp phone number.

                • phoneNumber (string) --

                  The phone number for sending WhatsApp.

                • phoneNumberId (string) --

                  The phone number ID. Phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901.

                • metaPhoneNumberId (string) --

                  The phone number ID from Meta.

                • displayPhoneNumberName (string) --

                  The display name for this phone number.

                • displayPhoneNumber (string) --

                  The phone number that appears in the recipients display.

                • qualityRating (string) --

                  The quality rating of the phone number.

    • statusCode (integer) --

      The status code for the response.

SendWhatsAppMessage (new) Link ¶

Send a WhatsApp message. For examples of sending a message using the Amazon Web Services CLI, see Sending messages in the Amazon Web Services End User Messaging Social User Guide .

See also: AWS API Documentation

Request Syntax

client.send_whatsapp_message(
    originationPhoneNumberId='string',
    message=b'bytes',
    metaApiVersion='string'
)
type originationPhoneNumberId:

string

param originationPhoneNumberId:

[REQUIRED]

The ID of the phone number used to send the WhatsApp message. If you are sending a media file only the originationPhoneNumberId used to upload the file can be used. Phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901. Use GetLinkedWhatsAppBusinessAccount to find a phone number's id.

type message:

bytes

param message:

[REQUIRED]

The message to send through WhatsApp. The length is in KB. The message field passes through a WhatsApp Message object, see Messages in the WhatsApp Business Platform Cloud API Reference.

type metaApiVersion:

string

param metaApiVersion:

[REQUIRED]

The API version for the request formatted as v{VersionNumber}. For a list of supported API versions and Amazon Web Services Regions, see Amazon Web Services End User Messaging Social API Service Endpoints in the Amazon Web Services General Reference.

rtype:

dict

returns:

Response Syntax

{
    'messageId': 'string'
}

Response Structure

  • (dict) --

    • messageId (string) --

      The unique identifier of the message.

ListLinkedWhatsAppBusinessAccounts (new) Link ¶

List all WhatsApp Business Accounts linked to your Amazon Web Services account.

See also: AWS API Documentation

Request Syntax

client.list_linked_whatsapp_business_accounts(
    nextToken='string',
    maxResults=123
)
type nextToken:

string

param nextToken:

The next token for pagination.

type maxResults:

integer

param maxResults:

The maximum number of results to return.

rtype:

dict

returns:

Response Syntax

{
    'linkedAccounts': [
        {
            'arn': 'string',
            'id': 'string',
            'wabaId': 'string',
            'registrationStatus': 'COMPLETE'|'INCOMPLETE',
            'linkDate': datetime(2015, 1, 1),
            'wabaName': 'string',
            'eventDestinations': [
                {
                    'eventDestinationArn': 'string'
                },
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • linkedAccounts (list) --

      A list of WhatsApp Business Accounts linked to your Amazon Web Services account.

      • (dict) --

        The details of a linked WhatsApp Business Account.

        • arn (string) --

          The ARN of the linked WhatsApp Business Account.

        • id (string) --

          The ID of the linked WhatsApp Business Account, formatted as waba-01234567890123456789012345678901.

        • wabaId (string) --

          The WhatsApp Business Account ID provided by Meta.

        • registrationStatus (string) --

          The registration status of the linked WhatsApp Business Account.

        • linkDate (datetime) --

          The date the WhatsApp Business Account was linked.

        • wabaName (string) --

          The name of the linked WhatsApp Business Account.

        • eventDestinations (list) --

          The event destinations for the linked WhatsApp Business Account.

          • (dict) --

            Contains information on the event destination.

            • eventDestinationArn (string) --

              The ARN of the event destination.

    • nextToken (string) --

      The next token for pagination.

TagResource (new) Link ¶

Adds or overwrites only the specified tags for the specified resource. When you specify an existing tag key, the value is overwritten with the new value.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    resourceArn='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the resource to tag.

type tags:

list

param tags:

[REQUIRED]

The tags to add to the resource.

  • (dict) --

    The tag for a resource.

    • key (string) -- [REQUIRED]

      The tag key.

    • value (string) --

      The tag value.

rtype:

dict

returns:

Response Syntax

{
    'statusCode': 123
}

Response Structure

  • (dict) --

    • statusCode (integer) --

      The status code of the tag resource operation.

PostWhatsAppMessageMedia (new) Link ¶

Upload a media file to the WhatsApp service. Only the specified originationPhoneNumberId has the permissions to send the media file when using SendWhatsAppMessage. You must use either sourceS3File or sourceS3PresignedUrl for the source. If both or neither are specified then an InvalidParameterException is returned.

See also: AWS API Documentation

Request Syntax

client.post_whatsapp_message_media(
    originationPhoneNumberId='string',
    sourceS3PresignedUrl={
        'url': 'string',
        'headers': {
            'string': 'string'
        }
    },
    sourceS3File={
        'bucketName': 'string',
        'key': 'string'
    }
)
type originationPhoneNumberId:

string

param originationPhoneNumberId:

[REQUIRED]

The ID of the phone number to associate with the WhatsApp media file. The phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901. Use GetLinkedWhatsAppBusinessAccount to find a phone number's id.

type sourceS3PresignedUrl:

dict

param sourceS3PresignedUrl:

The source presign url of the media file.

  • url (string) -- [REQUIRED]

    The presign url to the object.

  • headers (dict) -- [REQUIRED]

    A map of headers and their values. You must specify the Content-Type header when using PostWhatsAppMessageMedia. For a list of common headers, see Common Request Headers in the Amazon S3 API Reference

    • (string) --

      • (string) --

type sourceS3File:

dict

param sourceS3File:

The source S3 url for the media file.

  • bucketName (string) -- [REQUIRED]

    The bucket name.

  • key (string) -- [REQUIRED]

    The object key of the media file.

rtype:

dict

returns:

Response Syntax

{
    'mediaId': 'string'
}

Response Structure

  • (dict) --

    • mediaId (string) --

      The unique identifier of the posted WhatsApp message.

GetWhatsAppMessageMedia (new) Link ¶

Get a media file from the WhatsApp service. On successful completion the media file is retrieved from Meta and stored in the specified Amazon S3 bucket. Use either destinationS3File or destinationS3PresignedUrl for the destination. If both are used then an InvalidParameterException is returned.

See also: AWS API Documentation

Request Syntax

client.get_whatsapp_message_media(
    mediaId='string',
    originationPhoneNumberId='string',
    metadataOnly=True|False,
    destinationS3PresignedUrl={
        'url': 'string',
        'headers': {
            'string': 'string'
        }
    },
    destinationS3File={
        'bucketName': 'string',
        'key': 'string'
    }
)
type mediaId:

string

param mediaId:

[REQUIRED]

The unique identifier for the media file.

type originationPhoneNumberId:

string

param originationPhoneNumberId:

[REQUIRED]

The unique identifier of the originating phone number for the WhatsApp message media. The phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901. Use GetLinkedWhatsAppBusinessAccount to find a phone number's id.

type metadataOnly:

boolean

param metadataOnly:

Set to True to get only the metadata for the file.

type destinationS3PresignedUrl:

dict

param destinationS3PresignedUrl:

The presign url of the media file.

  • url (string) -- [REQUIRED]

    The presign url to the object.

  • headers (dict) -- [REQUIRED]

    A map of headers and their values. You must specify the Content-Type header when using PostWhatsAppMessageMedia. For a list of common headers, see Common Request Headers in the Amazon S3 API Reference

    • (string) --

      • (string) --

type destinationS3File:

dict

param destinationS3File:

The bucketName and key of the S3 media file.

  • bucketName (string) -- [REQUIRED]

    The bucket name.

  • key (string) -- [REQUIRED]

    The object key of the media file.

rtype:

dict

returns:

Response Syntax

{
    'mimeType': 'string',
    'fileSize': 123
}

Response Structure

  • (dict) --

    • mimeType (string) --

      The MIME type of the media.

    • fileSize (integer) --

      The file size of the media, in KB.

UntagResource (new) Link ¶

Removes the specified tags from a resource.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    resourceArn='string',
    tagKeys=[
        'string',
    ]
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the resource to remove tags from.

type tagKeys:

list

param tagKeys:

[REQUIRED]

The keys of the tags to remove from the resource.

  • (string) --

rtype:

dict

returns:

Response Syntax

{
    'statusCode': 123
}

Response Structure

  • (dict) --

    • statusCode (integer) --

      The status code of the untag resource operation.

ListTagsForResource (new) Link ¶

List all tags associated with a resource, such as a phone number or WABA.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    resourceArn='string'
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the resource to retrieve the tags from.

rtype:

dict

returns:

Response Syntax

{
    'statusCode': 123,
    'tags': [
        {
            'key': 'string',
            'value': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • statusCode (integer) --

      The status code of the response.

    • tags (list) --

      The tags for the resource.

      • (dict) --

        The tag for a resource.

        • key (string) --

          The tag key.

        • value (string) --

          The tag value.

PutWhatsAppBusinessAccountEventDestinations (new) Link ¶

Add an event destination to log event data from WhatsApp for a WhatsApp Business Account (WABA). A WABA can only have one event destination at a time. All resources associated with the WABA use the same event destination.

See also: AWS API Documentation

Request Syntax

client.put_whatsapp_business_account_event_destinations(
    id='string',
    eventDestinations=[
        {
            'eventDestinationArn': 'string'
        },
    ]
)
type id:

string

param id:

[REQUIRED]

The unique identifier of your WhatsApp Business Account. WABA identifiers are formatted as waba-01234567890123456789012345678901. Use ListLinkedWhatsAppBusinessAccounts to list all WABAs and their details.

type eventDestinations:

list

param eventDestinations:

[REQUIRED]

An array of WhatsAppBusinessAccountEventDestination event destinations.

  • (dict) --

    Contains information on the event destination.

    • eventDestinationArn (string) -- [REQUIRED]

      The ARN of the event destination.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

GetLinkedWhatsAppBusinessAccountPhoneNumber (new) Link ¶

Use your WhatsApp phone number id to get the WABA account id and phone number details.

See also: AWS API Documentation

Request Syntax

client.get_linked_whatsapp_business_account_phone_number(
    id='string'
)
type id:

string

param id:

[REQUIRED]

The unique identifier of the phone number. Phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901. Use GetLinkedWhatsAppBusinessAccount to find a phone number's id.

rtype:

dict

returns:

Response Syntax

{
    'phoneNumber': {
        'arn': 'string',
        'phoneNumber': 'string',
        'phoneNumberId': 'string',
        'metaPhoneNumberId': 'string',
        'displayPhoneNumberName': 'string',
        'displayPhoneNumber': 'string',
        'qualityRating': 'string'
    },
    'linkedWhatsAppBusinessAccountId': 'string'
}

Response Structure

  • (dict) --

    • phoneNumber (dict) --

      The details of your WhatsApp phone number.

      • arn (string) --

        The ARN of the WhatsApp phone number.

      • phoneNumber (string) --

        The phone number for sending WhatsApp.

      • phoneNumberId (string) --

        The phone number ID. Phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901.

      • metaPhoneNumberId (string) --

        The phone number ID from Meta.

      • displayPhoneNumberName (string) --

        The display name for this phone number.

      • displayPhoneNumber (string) --

        The phone number that appears in the recipients display.

      • qualityRating (string) --

        The quality rating of the phone number.

    • linkedWhatsAppBusinessAccountId (string) --

      The WABA identifier linked to the phone number, formatted as waba-01234567890123456789012345678901.