diff --git a/app/builders/messages/instagram/base_message_builder.rb b/app/builders/messages/instagram/base_message_builder.rb index 8b40ba3c9..818c217ca 100644 --- a/app/builders/messages/instagram/base_message_builder.rb +++ b/app/builders/messages/instagram/base_message_builder.rb @@ -112,6 +112,25 @@ class Messages::Instagram::BaseMessageBuilder < Messages::Messenger::MessageBuil return if story_reply_attributes.blank? @message.save_story_info(story_reply_attributes) + create_story_reply_attachment(story_reply_attributes['url']) + end + + def create_story_reply_attachment(story_url) + return if story_url.blank? + + attachment = @message.attachments.new( + file_type: :ig_story, + account_id: @message.account_id, + external_url: story_url + ) + attachment.save! + begin + attach_file(attachment, story_url) + rescue Down::Error, StandardError => e + Rails.logger.warn "Failed to download Instagram story attachment: #{e.message}" + end + @message.content_attributes[:image_type] = 'ig_story_reply' + @message.save! end def build_conversation diff --git a/app/javascript/dashboard/components-next/message/Message.vue b/app/javascript/dashboard/components-next/message/Message.vue index 6fa7ff2b2..c4ae45fef 100644 --- a/app/javascript/dashboard/components-next/message/Message.vue +++ b/app/javascript/dashboard/components-next/message/Message.vue @@ -303,6 +303,7 @@ const componentToRender = computed(() => { const instagramSharedTypes = [ ATTACHMENT_TYPES.STORY_MENTION, ATTACHMENT_TYPES.IG_STORY, + ATTACHMENT_TYPES.IG_STORY_REPLY, ATTACHMENT_TYPES.IG_POST, ]; if (instagramSharedTypes.includes(props.contentAttributes.imageType)) { diff --git a/app/javascript/dashboard/components-next/message/bubbles/InstagramStory.vue b/app/javascript/dashboard/components-next/message/bubbles/InstagramStory.vue index f167d6501..5c3bfc2f6 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/InstagramStory.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/InstagramStory.vue @@ -1,19 +1,26 @@