fix: Attachments download authentication issue in Tiktok (#13151)

Fixes
https://linear.app/chatwoot/issue/CW-6357/ensure-authentication-when-fetching-attachments
Update the attachment download method to include the access token in the
request headers, ensuring proper authentication when fetching
attachments.

https://business-api.tiktok.com/portal/docs?id=1832184455450626

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Mazen Khalil
2026-01-28 10:50:14 +03:00
committed by GitHub
parent 40c622ed95
commit 68f0da7351

View File

@@ -59,7 +59,7 @@ module Tiktok::MessagingHelpers
def fetch_attachment(channel, tt_conversation_id, tt_message_id, tt_image_media_id)
file_download_url = tiktok_client(channel).file_download_url(tt_conversation_id, tt_message_id, tt_image_media_id)
Down.download(file_download_url)
Down.download(file_download_url, headers: { 'x-user' => channel.validated_access_token })
end
def tiktok_client(channel)