chatwoot icon indicating copy to clipboard operation
chatwoot copied to clipboard

fix: Handle instagram direct message images using CDN url

Open pelucapampa opened this issue 1 year ago • 11 comments

Describe the bug

I'm on facebook approval process and we passed History Image CDN URL process OK. Now, facebook says if messege on Instagram Direct, is an image, we need to use Instagram CDN format (A valid CDN URL sample would be https://lookaside.fbsbx.com/ig_messaging_cdn/?asset_id... ) I check that on my self hosted installation and chatwoot use an internal URL. image

When I delete the message on Instagram, chatwoot show "This message was deleted", but not delete the image on conversation.

image

It's possible change that on code to use the same CDN URL on image, and delete the image for conversation when user deleted on instagram? (Similar Hisstory image functionallity) for obtain finally instagram_manage_message approve?

To Reproduce

1: Login into Instagram, search your account, go to message and send an image message 2: Back to chatwoot, open DevOptions and check de URL for the image.

Expected behavior

No response

Environment

Docker

Cloud Provider

None

Platform

Browser

Operating system

No response

Browser and version

No response

Docker (if applicable)

No response

Additional context

No response

pelucapampa avatar Dec 07 '23 11:12 pelucapampa

is this resolved now?

iaminamkhan avatar Dec 27 '23 16:12 iaminamkhan

Not yet!

pelucapampa avatar Dec 27 '23 16:12 pelucapampa

Hi @pranavrajs, Do you have any idea if it is possible to resolve this, how was the Instagram story resolved? Thanks. We are waiting to resolve this issue to request facebook approval for instagram and then we make a Go Live for Chatwoot.

pelucapampa avatar Jan 04 '24 13:01 pelucapampa

Hello @pranavrajs please add some priority for the fix, story issues CDN solved on v3.4.0 but I also confirm the issue on image messages. Still can't get advance Instagram permits here too.

egejo avatar Jan 04 '24 19:01 egejo

Hello all. Could you add Priority to this issue. It's important to Facebook Approval Team to asign advance instagram permissions. Thanks a lot.

pelucapampa avatar Jan 16 '24 14:01 pelucapampa

Hi! Please can you add Priority on this? Same problem here. Thanks!

jmelati avatar Jan 31 '24 13:01 jmelati

Hi all. This requirement has been added after our last audit of the integration. We are looking into this.

sojan-official avatar Jan 31 '24 14:01 sojan-official

Thanks @sojan-official

pelucapampa avatar Jan 31 '24 15:01 pelucapampa

Hi all. For those who can't wait: Go to -> app/models/attachment.rd change

metadata[:data_url] = metadata[:thumb_url] = external_url if message.instagram_story_mention?

to

metadata[:data_url] = metadata[:thumb_url] = external_url if message.instagram?

image

Go to -> app/models/concerns/message_filter_helpers.rd add

  def instagram?
    inbox.instagram?
  end

image

DenisKarlyuk avatar Feb 02 '24 15:02 DenisKarlyuk

@DenisKarlyuk would you be interested in turning this into a pull request ? 😇

sojan-official avatar Feb 03 '24 06:02 sojan-official

@DenisKarlyuk Thanks for share that solution, we modified this files, and work perfect. Now I'm sending app revision to facebook.

pelucapampa avatar Feb 06 '24 12:02 pelucapampa

@DenisKarlyuk Thanks for share that solution, we modified this files, and work perfect. Now I'm sending app revision to facebook.

Please create a Pull Request, that would be very helpfull for everyone who is facing this problem.

ultraza4 avatar Feb 28 '24 09:02 ultraza4

@pelucapampa @sojan-official Has this issue been fixed? I tested it here and even so, after deleting the file, it remained in the chat. Only the adjustment made the goal approved even though the file was maintained?

Elvner avatar Mar 29 '24 21:03 Elvner

@DenisKarlyuk Thank you very much for your contribution! But when I tested the image continues to be stored by rails and displayed within chatwoot even after deletion, can you help please? I wanted to confirm whether even displaying it on the front is possible for approval.

Elvner avatar Mar 29 '24 21:03 Elvner

@Elvner after the changes above and restarting the chatwoot the images should have the Instagram CDN url

DenisKarlyuk avatar Mar 30 '24 15:03 DenisKarlyuk

@DenisKarlyuk Would it be the network url or the HTML url that generates on the front? because on the front it has the rails link, and on the network too, would there be an ideal version for these adjustments to work?

So please confirm, what matters is that the link is on Instagram, isn't the message being kept in the chat even after deletion the problem?

Thanks!!!

Elvner avatar Mar 30 '24 16:03 Elvner

@Elvner Sorry, I don't remember the version, but if you did everything correctly, it should work.

To pass Facebook revision, an Instagram message (regardless of message type: image or text) must be removed from the chatwoot if it has been deleted from Instagram and links to images must be in Instagram CDN format as in the first message

DenisKarlyuk avatar Mar 30 '24 19:03 DenisKarlyuk

@DenisKarlyuk you are going to open a PR to fix the problem in chatwoot basecode ?

rafaelstelles avatar Apr 01 '24 18:04 rafaelstelles

@rafaelstelles this is part of how it should be, this is just a hotfix for passing Facebook revision. I can't run chatwoot locally to continue.

DenisKarlyuk avatar Apr 02 '24 08:04 DenisKarlyuk

note: added https://github.com/chatwoot/chatwoot/pull/9287/files with the changes from @DenisKarlyuk . We will test and get this merged

sojan-official avatar Apr 23 '24 23:04 sojan-official

Hi all. For those who can't wait: Go to -> app/models/attachment.rd change

metadata[:data_url] = metadata[:thumb_url] = external_url if message.instagram_story_mention?

to

metadata[:data_url] = metadata[:thumb_url] = external_url if message.instagram?

image

Go to -> app/models/concerns/message_filter_helpers.rd add

  def instagram?
    inbox.instagram?
  end

image

@DenisKarlyuk please how do I do this with a Docker installation? I'll appreciate if you can guide. Thank you.

tobsowo avatar May 15 '24 09:05 tobsowo

@tobsowo you should modify the files and than build the docker image using docker-compose.yaml at the root of the directory.

DenisKarlyuk avatar May 15 '24 09:05 DenisKarlyuk

@tobsowo you should modify the files and than build the docker image using docker-compose.yaml at the root of the directory.

@DenisKarlyuk Please, how do I access the file after I gain access to the shell? Will this also resolve auto deleting messages from IG and Chatwoot?

tobsowo avatar May 15 '24 10:05 tobsowo

@tobsowo

  1. Clone Chatwoot repository -> Change the files according to the instructions above -> Build the docker image using docker-compose.yaml
  2. Yes

DenisKarlyuk avatar May 15 '24 10:05 DenisKarlyuk

@DenisKarlyuk I just updated to v3.9 and it does not delete messages although this fix is merged into it. @sojan-official response here https://github.com/orgs/chatwoot/discussions/9479#discussioncomment-9454013

tobsowo avatar May 16 '24 08:05 tobsowo

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Jun 15 '24 10:06 github-actions[bot]