when I get conversations from converssations API end point I get the attachments list for each conversation item.
After that in server.js I try to get the attachment like this:
This could be due to the attachment URL being protected or expired. The URL may be pre-signed and only accessible for a limited time or under specific authorization conditions.
The attachment URL contains an Expires query parameter (Expires=1726750091). Check the expiration time and ensure that the URL has not expired. If the URL is expired, you will need to regenerate the URL or re-fetch the conversation from the API to get a fresh URL.
Also, try adding your API key in the headers when accessing the attachment. This might look like:
const response = await axios({
method: “GET”,
url: attachment_url,
responseType: ‘arraybuffer’,
headers: {
Authorization: 'Basic ’ + Buffer.from(‘your_api_key:X’).toString(‘base64’), // Replace ‘your_api_key’ with the actual API key
},
});