:doc:`EndUserMessagingSocial <../../socialmessaging>` / Client / get_whatsapp_message_media

**************************
get_whatsapp_message_media
**************************



.. py:method:: EndUserMessagingSocial.Client.get_whatsapp_message_media(**kwargs)

  

  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 <https://docs.aws.amazon.com/goto/WebAPI/socialmessaging-2024-01-01/GetWhatsAppMessageMedia>`_  


  **Request Syntax**
  ::

    response = 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 <https://docs.aws.amazon.com/social-messaging/latest/APIReference/API_GetLinkedWhatsAppBusinessAccount.html>`__ 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 <https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonRequestHeaders.html>`__ 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 S3 key prefix that defines the storage location of your media files. The prefix works like a folder path in S3, and is combined with the WhatsApp mediaId to create the final file path.

       

      For example, if a media file's WhatsApp mediaId is ``123.ogg``, and the key is ``audio/example.ogg``, the final file path is ``audio/example.ogg123.ogg``.

       

      For the same mediaId, a key of ``audio/`` results in the file path ``audio/123.ogg``.

      

    
  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'mimeType': 'string',
          'fileSize': 123
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **mimeType** *(string) --* 

        The MIME type of the media.

        
      

      - **fileSize** *(integer) --* 

        The size of the media file, in KB.

        
  
  **Exceptions**
  
  *   :py:class:`EndUserMessagingSocial.Client.exceptions.ValidationException`

  
  *   :py:class:`EndUserMessagingSocial.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`EndUserMessagingSocial.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`EndUserMessagingSocial.Client.exceptions.InvalidParametersException`

  
  *   :py:class:`EndUserMessagingSocial.Client.exceptions.AccessDeniedByMetaException`

  
  *   :py:class:`EndUserMessagingSocial.Client.exceptions.ThrottledRequestException`

  
  *   :py:class:`EndUserMessagingSocial.Client.exceptions.InternalServiceException`

  
  *   :py:class:`EndUserMessagingSocial.Client.exceptions.DependencyException`

  