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

360Dialog WhatsApp #1645

Merged
merged 60 commits into from
Nov 1, 2023
Merged

360Dialog WhatsApp #1645

merged 60 commits into from
Nov 1, 2023

Conversation

mattwr18
Copy link
Contributor

@mattwr18 mattwr18 commented Jun 3, 2023

TODOS

Client onboarding

  • Add integrated onboarding button (where should it live? Settings page?, Should we prefill the sign up form on 360dialog?)
  • Improve UX, favor modal over new tab
  • Consume redirect and schedule job to create api key
  • Successfully create api key through integrated onboarding process
  • Way to set profile info/image by api?

Configure instance for 360dialog WhatsApp

  • Configure webhook url
  • Create templates via API (currently dealing with error which has been reported to 360dialog support)

Send/receive messages

  • Send template messages with api_key ☝️
  • Receive message/handle them - request for more info, to unsubscribe, to re-subscribe, to receive latest message
  • Add feature that allows contributor to receive previous requests
  • Send freeform text message
  • Send freeform file message
  • Receive files

Testing

  • Fix failing tests
  • Add automated tests

Replies

  • Support replies
    1. Process status webhook callback to save the whats_app_message_id params[:statuses].first[:id]
    2. When a contributor replies, we receive a context object with the message id, which can be used to lookup and/or display the message. params[:messages].first[:context][:id]

@mattwr18 mattwr18 changed the title Add WhatsAppAdapter::Outbound::Template class 360Dialog WhatsApp Jun 3, 2023
mattwr18 added 25 commits July 26, 2023 18:37
- At the moment, we have some legacy clients with Twilio, but are
  planning to onboard new clients with 360dialog. We check if we have an
360dialog API key for the client to determine which implementation to
use.
- request for more info
- request to unsubscribe
- request to re-subscribe
- it should be id, not external_id
- handle error trying to create duplicate template name
- Fetch the existing templates and do not attempt to create a template
  with the same name to avoid predictable errors
- image/audio/video
- namespace api_key setting in client
- DRY out the code by separating the two implementations of WhatsApp by
  business solution provider
- initialize setting, then save
- use correct response code in handle_response
{ name: %i[first_name formatted_name last_name] }] }])
end

def create_api_key_params
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe use a different controller for messaging and setup?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, originally I added this in a separate controller, see 9468a86 (#1645)

I put it here because I wanted to differentiate between client/contributor onboarding, but maybe we could separate it again and rename it to WhatsApp::SetupController, or something similar?

- We might want to create a new api key for any number of reasons. If
  the api key is exposed, for example.
- follow @roschaefer PR suggestion and simplify the code
- I added the automatic creation of a User as a contact person, when
  this is actually optional. We always create a contact person for an
organization though, so maybe we should consider making this change in a
different PR
- we experienced buggy behavior when the setting was intialized in a job
  where the value was not accessible to be queried using the syntax
sugar Setting.three_sixty_dialog_client_api_key. Initializing with an
empty string means the setting gets created on intialization of the
server and we didn't run into an issue updating the value and accessing
it straight away.
@mattwr18 mattwr18 merged commit beee331 into main Nov 1, 2023
1 check passed
@mattwr18 mattwr18 deleted the 360dialog_spike branch November 1, 2023 13:10
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 this pull request may close these issues.

2 participants