Utilizing the API to Download Email Attachments

Utilizing the API to Download Email Attachments

This article reviews the specific API calls used to gather an email attachment and download it from a temporary link.

Getting Email Attachment

  1. Use the Get Email Record api:
    curl --request POST \
      --url https://api.fathomvoice.com/V2/queues/email/get/ \
      --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
      --form cKey1= companycKey1 \
      --form cKey2=companycKey2 \
      --form queueCallManagerID=QCMID

  2. Once you have the response, you will have a key along with the attachment filename.
    Example: xxxkeyxxx-fileName.pdf
    You will need the filename that contains the key for this to work. Filename only will not return any results.

Sending Request to AWS

  1. Use that as the fileName in a new request with AWS Get Object Link api:
    curl --request POST \
      --url https://api.fathomvoice.com/V2/aws/getObjectLink/ \
      --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
      --form cKey1=companycKey1 \
      --form cKey2=companycKey2 \
      --form bucketName=messagemedia \
      --form fileName=xxxkeyxxx-fileName.pdf

  2. This will give you a direct link to the file from AWS, just like call recordings. You will have to fix the url format by doing a find and replace to remove the “\” from the returned URL . This link has all of the access and signature keys as voice recordings, as well as having an expiration 1 hour from link creation time. 

Return Example using Insomnia Application