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

[Spike] Technical approach to nudge users #836

Closed
Tracked by #1685
mahalakshme opened this issue Dec 16, 2024 · 7 comments
Closed
Tracked by #1685

[Spike] Technical approach to nudge users #836

mahalakshme opened this issue Dec 16, 2024 · 7 comments
Assignees

Comments

@mahalakshme
Copy link
Contributor

mahalakshme commented Dec 16, 2024

Need:

Figure out the approach to send Glific message to users who have not entered data for past 5 days.

Suggested approach:

  • Do in integration service to retain sanity and not to corrupt ETL
  • Store custom_query to retrieve users who have not entered data for past 5 days
  • Have a window such that the job should not send message to the same users for whom message was sent in the past 23 hours. So somewhere need to store the users data for whom message was sent in the past 23 hours.
  • Store the manual_message in table
  • Call the new api to sent glific message - one user at a time
  • Currently we can retain the 4 days timeline to retry for any failed messages.
  • A report with data on so far who has received message and for whom message sending has failed - If possible send notification from the report.
  • For more details refer the other cards in this epic

AC:

Identify any gaps in the above technical approach and make sure the above suggestions would work.

@petmongrels
Copy link
Contributor

petmongrels commented Dec 20, 2024

Re: A report with data on so far who has received message and for whom message sending has failed - If possible send notification from the report.

  • There are two points of failure. a) Integration service failing to call Avni Server to create a message b) Avni Server failing to call Glific.

Other options:

option 1

  1. integration service calls a new avni-server api to send message
  2. this new api sends the message directly to glific synchronously using the config it has for message & glific environment
  3. integration service is supposed to keep retrying the failed messages anyway. We have our monitoring report connecting to integration service database.

option 2

  1. integration service calls a glific to send message
  2. downside - glific config and message template logic has to be replicated in integration service

@mahalakshme
Copy link
Contributor Author

@petmongrels

Cons of option 2: i was also writing something similar

  • The cons I see is duplicating the glific code and database schema in the integration and any issues we find we will only fix it in integration service and might not help in improving the common codebase
  • Also from the discussions I think enhanced version of this will be asked and if done in integration - it might lead to forking out of Glific logic itself

Pros:

  • I think with reporting we can attain the pros of option 2 with option 1 as well
  • Why synchronously? Currently we have everything as part of bg job - what advantage will we get by making it synchronously-wont this lead to affecting the performance of foreground thread, considering we are also going to retry and there are around 1500 users.

@petmongrels
Copy link
Contributor

Integration service is keeping track of which message is sent or not because the call between avni-server and integration-service can fail. If we make it synchronous there will be nothing to track in avni-server hence we need to do report only from integration service.

At max we may be sending about 100 messages in a whole day. This is also high. I don't see any performance issue here.

@himeshr himeshr moved this from Ready to In Progress in Avni Product Dec 23, 2024
@himeshr himeshr self-assigned this Dec 23, 2024
@himeshr
Copy link
Contributor

himeshr commented Dec 23, 2024

Points of Consideration

  • Release 11.0 might have to stabilize for us to make use of the GlificMsgSync API, code changes are very minial so can also be manually ported/ cherry-picked to earlier release for RWB
  • Do we need to store all entries for Successful nudge for users, as well as attempts or clear them up and save only latest attempt info.?

No Major concerns found with the technical approach of synchronousUserNudge and ErrorRecord keeping to avoid repeated nudge.

himeshr added a commit to avniproject/integration-service that referenced this issue Dec 24, 2024
himeshr added a commit to avniproject/integration-service that referenced this issue Dec 24, 2024
himeshr added a commit to avniproject/integration-service that referenced this issue Dec 25, 2024
himeshr added a commit to avniproject/integration-service that referenced this issue Dec 25, 2024
himeshr added a commit to avniproject/integration-service that referenced this issue Dec 25, 2024
himeshr added a commit to avniproject/integration-service that referenced this issue Dec 30, 2024
…d skip if nudged successfully in last 1 week
@himeshr himeshr moved this from In Progress to Done in Avni Product Dec 30, 2024
@mahalakshme mahalakshme moved this from Done to Further Action Required in Avni Product Dec 30, 2024
@mahalakshme
Copy link
Contributor Author

@himeshr please add your findings or approach that you suggest

@mahalakshme mahalakshme reopened this Dec 30, 2024
@github-project-automation github-project-automation bot moved this from Further Action Required to Triaged in Avni Product Dec 30, 2024
@mahalakshme
Copy link
Contributor Author

oh you have edited the same comment - just now noted @himeshr

@mahalakshme
Copy link
Contributor Author

@himeshr yeah we need to store successful nudge as well - to show in reports - else we will not have any info to make sure if all expected users are receiving nudges - My opinion - since this is integrated system it becomes more important.

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

No branches or pull requests

4 participants