tenants icon indicating copy to clipboard operation
tenants copied to clipboard

Research integrating the Advocate Code system

Open romeboards opened this issue 7 years ago • 10 comments

The advocate code system allows a tenant user to be associated with an advocate user. When the tenant signs up, they'll be asked to enter the provided Advocate Code (see here for an example).

We want to append the advocate code to the provided link in the SMS content, i.e. https://www.justfix.nyc?q=samplecode

However, we can't know the length of the advocate code, which is a problem given our 160 character length of the SMS. So we'll probably want some sort of hash system or key-value mapping that would allow https:/www.justfix.nyc?q=1 where 1 => samplecode

Finally, when a user navigates to this link with the Advocate Code in the query string, we'll want to prepopulate the form with the code OR directly navigate the user to the post-code-entered state.

romeboards avatar Mar 29 '17 22:03 romeboards

Hey Dan, Can you share few sample Advocate codes with me? Also, a snapshot of the Database column type(from MongoDB) that this field is mapped to? Thanks!

kiranvalsia avatar Mar 30 '17 20:03 kiranvalsia

Angular detects the query string (?q=samplecode) Angular makes the call to validate the code If successful, we redirect to the Code Referral Landing Page

romeboards avatar Apr 13 '17 22:04 romeboards

https://github.com/angular-ui/ui-router/wiki#resolve

romeboards avatar Apr 21 '17 18:04 romeboards

  1. Detect queryString in public/modules/core/config/core.client.config.js (see line 43 for a different qs detection).
  2. If theres a string, redirect to /onboarding/referral
      if($location.search().q) {
        $location.path('/onboarding/referral');
      }
  1. State logic in public/modules/onboarding/config/onboarding.client.routes.js has a resolve that validates the query, then either renders the view with the advocate data or redirects to the general signup page (/signup)

Pseudocode: https://gist.github.com/romeboards/894f3d1ed55fd2444a61f19cd474f28c

romeboards avatar Apr 21 '17 18:04 romeboards

@kiranvalsia see attached for a comp of the new advocate landing page! thanks!!

access code sms

romeboards avatar Apr 23 '17 01:04 romeboards

Hi @kiranvalsia ! Thanks for the great work. Have you been able to test this yet by creating some sample advocate codes and tenant users?

romeboards avatar May 09 '17 15:05 romeboards

Hi @romeboards . Actually, I am having trouble testing it on my local DB instance. I will send you more details tomorrow. Thanks.

kiranvalsia avatar May 10 '17 02:05 kiranvalsia

Hi @kiranvalsia - please let me know and hopefully I can be of assistance!

romeboards avatar May 11 '17 17:05 romeboards

Hi @romeboards So far, I have mock tested the flow by passing the advocate code in the UI (?code=123 appended to the URL) and the url gets routed to the new landing page.

As for DB, i start the local MongoDB instance and when I signup, I get success message on UI(Below is the screenshot). But no records are inserted in the DB. Can you tell me what I am missing? (which DB user,tables etc) so I can create some sample advocate codes and tenant users?

Alternatively, I was thinking to import the db tables into my local Mongo instance, so I could test the validation. What do you think?

kiranvalsia avatar May 11 '17 20:05 kiranvalsia

screen shot 2017-04-28 at 3 40 29 pm

kiranvalsia avatar May 11 '17 20:05 kiranvalsia