social icon indicating copy to clipboard operation
social copied to clipboard

[16.0][MIG] mail_broker + mail_broker_telegram + mail_broker_whatsapp: migration to 16.0

Open etobella opened this issue 1 year ago • 43 comments

TODO:

  • In the chat window with contacts:
  • [ ] Ability to switch the communication medium to one incorporated by this system.
  • [x] Reception of responses in the same window.
  • [x] Support for reactions and emojis.
  • [x] Support for voice messages, images, and stickers.
  • [x] Support edition of messages
  • In the chatter of documents:
  • [x] Ability to send messages through one of these communication mediums.
  • [x] These messages will also be displayed in the contact's chat window with a navigable reference to the document.
  • [ ] Ability for direct navigation from each message to the general chat window with scrolling to the conversation fragment. --> Partially done. Odoo is not using it by default :thinking:
  • [x] If the WhatsApp/Telegram reply option is used, identifying only the message origin, then the reply will also be placed in the chatter of the original document of the reply.
  • Documentation
    • [x] Add documentation for whatsapp configuration
    • [x] Add documentation for telegram configuration

Also it includes web_broker_telegram for testing, because it is easier to configure for testing purposes.

etobella avatar Feb 12 '24 07:02 etobella

image

image

Now it starts to look properly.

I will add Whatsapp functionality and then I will finish with the change automatic sending using message templates :tada:

etobella avatar Feb 19 '24 14:02 etobella

@etobella can you rebase please :) ??

marcelsavegnago avatar Feb 23 '24 18:02 marcelsavegnago

image Added a whatsapp automatic view in order to start conversations.

We cannot know if a number exists in whatsapp before we sand a message :disappointed:

etobella avatar Feb 24 '24 23:02 etobella

Nice start! Is there any plan to handle situations, where telegram bot is used to post messages on telegram channel?

em230418 avatar Feb 29 '24 05:02 em230418

hi @etobella , awesome work with that, i know that is a bit soon, but i was testing in one of my instances, and with the telegram bot, when i receive (the "client" sends) any attachment (image, sticker, audio etc.) that error starts to "explode", blocking the bot to continue receiving messages...

https://gist.github.com/augustodinizl/85043550942d1c907505c4c1dda6f9b1

Thank you for your awesome work

augustodinizl avatar Mar 01 '24 21:03 augustodinizl

Thanks @augustodinizl I will check what might happen. Thanks for reviewing it.

etobella avatar Mar 01 '24 22:03 etobella

@etobella , you have plans to include a debug tool into the mail_broker_whatsapp? since meta has it already here: https://developers.facebook.com/docs/whatsapp/on-premises/guides/wadebug

augustodinizl avatar Mar 02 '24 14:03 augustodinizl

WADebug is for On-Premises API, but this API is being deprecated by Meta

etobella avatar Mar 02 '24 14:03 etobella

@augustodinizl Error should be fixed right now.

etobella avatar Mar 02 '24 22:03 etobella

WADebug is for On-Premises API, but this API is being deprecated by Meta

Tks man, srry

augustodinizl avatar Mar 02 '24 22:03 augustodinizl

@augustodinizl Ya debería estar arreglado el error que encontraste.

No errors... But it was preliminary tests with WABA, it says connected, but I couldn't be able to get logs yet, again, thank you for the awesome work

augustodinizl avatar Mar 02 '24 22:03 augustodinizl

where does it says connected?

etobella avatar Mar 03 '24 09:03 etobella

@augustodinizl Error should be fixed right now.

Tks for the effort and awesome work man, i can confirm that images and audios are working now for telegram, but stickers are causing troubles yet: https://gist.github.com/augustodinizl/3415b9ece314ae5c519419be05d94e5a

augustodinizl avatar Mar 04 '24 16:03 augustodinizl

where does it says connected?

now, for the broker_whatsapp, i got that one: image https://gist.github.com/augustodinizl/59dfeaeb520b897ecd396b8264e17971

augustodinizl avatar Mar 04 '24 16:03 augustodinizl

On the whastapp from phone you need to write the Identifier of the number, not the number.

image

etobella avatar Mar 04 '24 17:03 etobella

On the whastapp from phone you need to write the Identifier of the number, not the number.

image

changed and getting the same error

2024-03-04 19:22:12,158 1 ERROR ltxxxxxd odoo.addons.mail_broker_whatsapp.models.mail_broker_whatsapp: Traceback (most recent call last): File "/mnt/extra-addons/mail_broker_whatsapp/models/mail_broker_whatsapp.py", line 250, in _send response.raise_for_status() File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.facebook.com/v19.0/2xxxxxx9/messages

augustodinizl avatar Mar 04 '24 19:03 augustodinizl

Can you check here https://github.com/OCA/social/pull/1305/files#diff-f895447007b77592f5fc6891519e5fb56edfd9334069b6d877bdfc7e0f04531aR250 the result of the request before raising the error?

etobella avatar Mar 06 '24 09:03 etobella

Can you check here https://github.com/OCA/social/pull/1305/files#diff-f895447007b77592f5fc6891519e5fb56edfd9334069b6d877bdfc7e0f04531aR250 the result of the request before raising the error?

@etobella , sorry about the hiatus, i found one of the causes for whatsapp broker don't worked properly for me at first, one setting on api was wrong (my mistake), now i can receive messages in odoo... But i`m still unable to send messages (the odoo log says 200 when i send a message), but i don't know yet how to "debug" it in meta side...

The logs on odoo: 2024-03-15 20:21:36,517 1 INFO ltcs_prod werkzeug: 192.168.0.67 - - [15/Mar/2024 20:21:36] "POST /mail/channel/notify_typing HTTP/1.1" 200 - 11 0.005 0.050 2024-03-15 20:21:37,323 1 INFO ltcs_prod werkzeug: 192.168.0.67 - - [15/Mar/2024 20:21:37] "POST /mail/channel/notify_typing HTTP/1.1" 200 - 11 0.005 0.058 2024-03-15 20:21:37,985 1 INFO ltcs_prod werkzeug: 192.168.0.67 - - [15/Mar/2024 20:21:37] "POST /mail/message/post HTTP/1.1" 200 - 31 0.020 0.661 2024-03-15 20:21:38,069 1 INFO ltcs_prod werkzeug: 192.168.0.67 - - [15/Mar/2024 20:21:38] "POST /mail/link_preview HTTP/1.1" 200 - 5 0.003 0.004 2024-03-15 20:21:39,016 1 INFO ltcs_prod werkzeug: 192.168.0.79 - - [15/Mar/2024 20:21:39] "POST /broker/whatsapp/ltcs/update HTTP/1.1" 200 - 5 0.004 0.015

augustodinizl avatar Mar 15 '24 20:03 augustodinizl

@etobella , i'm still struggling to send messages from odoo to WaBa, is there some setting to show that answer from meta servers in the logs or some other place? TIA image

augustodinizl avatar Apr 03 '24 22:04 augustodinizl

@liebana I think you are talking about automation, isn't it?

etobella avatar Apr 16 '24 08:04 etobella

@etobella , i found another "adverse behavior" here in my tests, when the mail_gatewat is installed, odoo is unable to complete requests for video meetings, the error states that mail.gateway is blocking the attempt...

here's the error: https://gist.github.com/augustodinizl/0da08ff7865df22ddeb861f36949e620

Steps to reproduce:

  1. install mail.gateway 2)in mail, click on "Start a meeting" 3)copy the link to share the meeting 4)try to open that link in other browser (different device) 5)500 error is showed in that device when we access the link

augustodinizl avatar May 11 '24 17:05 augustodinizl

@augustodinizl It is fixed now. Thanks for the review!! :smile:

etobella avatar May 14 '24 20:05 etobella

@augustodinizl It is fixed now. Thanks for the review!! :smile:

Thanks man...

Awesome work!!!

augustodinizl avatar May 14 '24 20:05 augustodinizl

@etobella , do you tested the mail_gateway_whatsapp using cloudflared as solution for proxy+SSL? i think my problem here with outbound messages from odoo to WaBa API have roots there...

augustodinizl avatar May 14 '24 20:05 augustodinizl

I tested it using ngrok. Usually I test with telegram because it is easier to configure

etobella avatar May 14 '24 21:05 etobella

Is this finally ready? Can you squash a bit commit history?

pedrobaeza avatar May 15 '24 06:05 pedrobaeza

History has been squashed. This weekend I will recheck Whatsapp in order to ensure that everything is right, and then we could proceed with merge :tada:

etobella avatar May 16 '24 12:05 etobella

@pedrobaeza I tested today whatsapp Again and works like a charm. IMO, we can proceed with merge :smile:

etobella avatar May 16 '24 19:05 etobella

I still need to improve coverage, but at least the comments have been attended (pushing in order to ensure that all is fine)

etobella avatar May 17 '24 10:05 etobella

OK, waiting for that.

pedrobaeza avatar May 17 '24 11:05 pedrobaeza