Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle instagram direct message images using CDN url #8512

Closed
pelucapampa opened this issue Dec 7, 2023 · 25 comments · Fixed by #9287
Closed

fix: Handle instagram direct message images using CDN url #8512

pelucapampa opened this issue Dec 7, 2023 · 25 comments · Fixed by #9287

Comments

@pelucapampa
Copy link

pelucapampa commented Dec 7, 2023

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

@thelosergeek
Copy link

is this resolved now?

@pelucapampa
Copy link
Author

Not yet!

@pelucapampa
Copy link
Author

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.

@egejo
Copy link

egejo commented Jan 4, 2024

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.

@pelucapampa
Copy link
Author

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

@jmelati
Copy link

jmelati commented Jan 31, 2024

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

@sojan-official
Copy link
Member

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

@pelucapampa
Copy link
Author

Thanks @sojan-official

@sojan-official sojan-official changed the title Instagram Direct - Image sent URL fix: Handle instagram direct message images using CDN url Feb 1, 2024
@DenisKarlyuk
Copy link

DenisKarlyuk commented Feb 2, 2024

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

@sojan-official
Copy link
Member

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

@pelucapampa
Copy link
Author

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

@ultraza4
Copy link

@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.

@Elvner
Copy link

Elvner commented Mar 29, 2024

@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
Copy link

Elvner commented Mar 29, 2024

@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.

@DenisKarlyuk
Copy link

DenisKarlyuk commented Mar 30, 2024

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

@Elvner
Copy link

Elvner commented Mar 30, 2024

@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!!!

@DenisKarlyuk
Copy link

@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

@rafaelstelles
Copy link

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

@DenisKarlyuk
Copy link

@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.

@sojan-official
Copy link
Member

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

pranavrajs pushed a commit that referenced this issue Apr 30, 2024
Fixes: #8512

Co-authored-by: Denis Karlyuk <[email protected]>
Co-authored-by: Shivam Mishra <[email protected]>
deivisonrpg pushed a commit to deivisonrpg/chatwoot that referenced this issue May 2, 2024
@tobsowo
Copy link

tobsowo commented May 15, 2024

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.

@DenisKarlyuk
Copy link

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

@tobsowo
Copy link

tobsowo commented May 15, 2024

@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?

@DenisKarlyuk
Copy link

@tobsowo

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

@tobsowo
Copy link

tobsowo commented May 16, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants