-
Notifications
You must be signed in to change notification settings - Fork 1
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
[improvement] WhatsApp file uploading/sending and error handling #2072
Conversation
693071c
to
a37caf6
Compare
payload: text_payload( | ||
recipient, message.text | ||
), | ||
message_id: message.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be a better UX to upload the file, if one is attached, then send out the file and after it was sent successfully. Alternatively, I've since clarified that we can send the message text as a caption with a limit of 1024 characters. So, we could potentially do that. For telegram, we check if the message text is greater than the limit and if it is we send it separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is looking good! 👍
We can do the caption idea that you mention, but we can also keep things simple stupid and just send files immediately followed by a text message, no? I do this often myself.
), | ||
message_id: message.id) | ||
else | ||
files.each do |_file| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to enqueue UploadFileJob
s for every _file
. Does it matter that we enqueue only one job now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually was an oversight. We iterated through every file attached to a message to schedule a job to upload the file, but then iterated through a request's files to actually upload them so we were uploading many more files than were necessary.
a77b7da
to
0f70a5e
Compare
- Extract the logic to upload the files and broadcast WhatsApp messages to its own job that can be re-run in case the upload file service fails. - Scope external file ids to whats_app
c9ac345
to
8637544
Compare
TODO:
Specs for statuses/errors will be added in the PR that actually handles statuses.