-
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
Implement observer for whatsApp webhook, also potentially for other modules #61
Comments
Currently we have ./app/code/webhookWhatsApp/index.js which has a run() method which defines the following response to a whatsapp message:
Your taskImplement the Observer pattern, defined in https://en.wikipedia.org/wiki/Observer_pattern, to do the following:
// returns a uuid of this observer. Now when webhookWhatsApp receives a message from, say, +15551234567, instead of replying "!!! Well received !!!", we want to do something like this:
If you want to get all observers, you can do:
// This will return all observers as an array, and each observer will have its UUID in a uuid key. It might return somethng like this:
If you want to remove an observer, you can either set it to expire using expire key, or you can remove it using the UUID like this:
So to delete our observer you would run:
For now we'll use it only for WhatsApp webhook, but we want the solution to be generic enough to be used by any module which wants to implement the observer pattern. Concretely, all the heavy lifting will be done in the "observers" module, and the webhookWhatsApp will only have this small change. Instead of:
we will have:
|
No description provided.
The text was updated successfully, but these errors were encountered: