damus-io / damus

iOS nostr client
GNU General Public License v3.0
1.99k stars 288 forks source link

Personalized invite a friend (The Daniel's onboarding) #1696

Open alltheseas opened 10 months ago

alltheseas commented 10 months ago

user story

As a Damus and nostr ambassador, I would like a way to send a personalized Damus invite to my friend with pre-loaded content & sats, so that they have a great experience when they join and they are more likely to stay.

acceptance criteria

  1. -[ ] There is a "Invite a Friend to Damus" button (see mockup below)
  2. -[ ] Invite sender can suggest friends to follow for their friend
  3. -[ ] Invite sender can suggest hashtags to follow for their friend
  4. -[ ] Invite sender can suggest relays to add to default Damus relay list
  5. -[ ] Invite sender can pay for friend's paid relays (i.e. pay for write capabilty)
  6. -[ ] Invite sender can pre-load their friend's LN wallet
  7. -[ ] Invitee automatically follows invite sender

design / open questions

  1. should there be a cap of users to follow?
  2. should there be a cap of hashtags to follow?
  3. should there be a cap of relays suggested?
  4. should there be a cap of sats pre-loaded?
  5. should the invite sender be allowed to modify the Damus bootstrap list?
  6. Should the invitee have any choice as to what their friend suggested (e.g. choose to follow some user follow suggestions)?

pre-requisites for pre-loading wallet with sats

user flow

Screenshot 2023-11-11 at 11 33 20 PM

invite friend mockup

invite friend

alltheseas commented 10 months ago

@robagreda what do you think 👀

alltheseas commented 10 months ago

@danieldaquino what do you think of the technical feasibility and points for this ticket? My gut feel is that we'll need to break it down to smaller pieces, and maybe rearrange the flow to make execution simpler.

danieldaquino commented 10 months ago

@alltheseas, my gut feel is that we will likely need to break this down into at least 2 or 3 separate parts, which I would imagine could be ordered in this sequence:

  1. Implement general flow and setup of basic settings (e.g. Which friends to follow)
  2. Implementation of any remaining setting (If not easily done in (1))
  3. Implementation of money-related setups (like pre-paid relays or pre-loaded sats)
danieldaquino commented 10 months ago

@alltheseas, @jb55, for the preloading of sats, one thing that came to my mind was the Bitcoin "laisee" (https://laisee.org), where the person giving the sats can create a lightning QR code that the recipient can use to redeem sats to their own wallet.

I would imagine that whatever underlying lightning protocol mechanisms are used there could potentially be useful here.

alltheseas commented 10 months ago

@alltheseas, @jb55, for the preloading of sats, one thing that came to my mind was the Bitcoin "laisee" (https://laisee.org), where the person giving the sats can create a lightning QR code that the recipient can use to redeem sats to their own wallet.

I would imagine that whatever underlying lightning protocol mechanisms are used there could potentially be useful here.

Interesting! Maybe the redeem code is DM'd from the inviter to the newly created profile? What happens if I tap on a QR code in DMs? Testing now.

danieldaquino commented 10 months ago

@alltheseas, I believe the QR code in the Laisee points to a special lightning url.

A DM could be one way to deliver it, but that URL could also (in theory) be embedded together with the rest of the settings, or in a way that Damus could immediately understand and redeem it.

alltheseas commented 10 months ago

that URL could also (in theory) be embedded together with the rest of the settings, or in a way that Damus could immediately understand and redeem it.

Sounds great. Redeeming from a QR in DMs is a painful experience, just tested.

alltheseas commented 10 months ago

https://onboardstr.vercel.app/ implemented this with the following flow:

  1. input an existing npub
  2. copy follow list, and relay list
  3. generate private key with follow list, and relay list preconfigured
alltheseas commented 10 months ago

Onboardstr by Bera implemented something very similar yesterday!

An insight gleaned from testing onboardstr: what if we could append the inviter's npub to the Damus invite link? If invitee taps, and installs Damus they automagically have relays and follow lists either added, or suggested.

https://damus.io/note1g8ypuxjkmn4gse5d3nx22f5h5zyyuxaglsgedqghexl5hly3xkasu03wrd

jb55 commented 10 months ago

On Thu, Nov 16, 2023 at 08:54:58PM -0800, alltheseas wrote:

Onboardstr by Bera implemented something very similar yesterday!

An insight gleaned from testing onboardstr: what if we could append the inviter's npub to the Damus invite link? If invitee taps, and installs Damus they automagically have relays and follow lists either added, or suggested.

https://damus.io/note1g8ypuxjkmn4gse5d3nx22f5h5zyyuxaglsgedqghexl5hly3xkasu03wrd

As far as I know you can't pass information into an appstore download link.

Here's an idea:

Create a note of kind X with random phrase as a d parameter on the note: bob-is-cool

This note could reference a contact list that would be copied to that users contact list on account creation.

The only downside here is that people can see these notes and create fake ones that override the ones your friend made... hmm.

Spammers could grief these pretty hard, and they would have incentive to do so...

Alternatively we could create a private service that only allows unique keys and just use that.

alltheseas commented 10 months ago

Alternatively we could create a private service that only allows unique keys and just use that.

What does this entail? A private relay with the note mechanism you described above?

jb55 commented 10 months ago

the note would contain a contact list of users to follow. Maybe these would expire after some time.

https://github.com/damus-io/damus/issues/1748

danieldaquino commented 10 months ago

@jb55, would it be possible to register another custom URL scheme on the app?

If so, we might be able to eliminate the need for copying/pasting invite codes. We could generate special URLs under this new scheme containing the data they need.

So once the user has Damus installed, all they would need to do is click on the special link provided to them, or scan a QR code for that URL. Then we could setup the app to interpret these special data urls, confirm details with the user, and load everything.

Here is one example:

  1. User generates recommendations with some json data such as {"recommended_users": ["0f8cdd97(...)", (...)], (...)}
  2. They get a shareable URL such as https://invite.damus.io/?data=eyJyZWNvbW1lbmRlZF91c2VycyI6IFsiMGY4Y2RkOTcoLi4uKSIsICguLi4pXSwgKC4uLik=
  3. The static page shows install instructions with two steps: (1) Install Damus on App store (2) Click on this link (Where the link is something like damus-invite:eyJyZWNvbW1lbmRlZF91c2VycyI6IFsiMGY4Y2RkOTcoLi4uKSIsICguLi4pXSwgKC4uLik=)
  4. Damus reads the link, decodes it, and proceeds with the configuration import

The upside of the above is removing the need of any server-side functionality. The downside is that the URLs might get huge.

Another possibility:

Another possibility would be saving that JSON data as a special nostr note, so all 4 steps above would apply — however instead of a big base64 string, we would have only a short nostr note id. (And since note ids are SHA256 hashes of the signed note contents, a spammer would not be able to generate spammy invite data that matches the legitimate note id and invite URL)

Example:

  1. User generates a note, which gets sent to a special private relay
  2. User generates and sends the shareable invite link: https://invite.damus.io/nevent08ab4f(...)
  3. Invite link shows the user (1) the app store link and (2) prompts them to click on the link damus-invite:nevent08ab4f(...)
  4. Damus would open this special scheme url, and proceed with loading/applying the contents of nevent08ab4f(...)

On this one, we might not even need a new URL scheme at all, we might be able to use damus:nevent08ab4f(...) and detect based on the note kind 🤔

alltheseas commented 9 months ago

@pablof7z example Uncle Jim onboarding flow that uses nip-05 + uncle Jim domain provides automagically LN address for newly onboarded folks

https://damus.io/note18kma8hr0dcyy30u0272473u2ggacgws6xlue5e7dexnqatfc4mdshmvgse

alltheseas commented 2 months ago

@ericholguin wdyt of this one, minus the LN wallet (for which we dont have a ready solution today)?

ericholguin commented 2 months ago

@ericholguin wdyt of this one, minus the LN wallet (for which we dont have a ready solution today)?

I think it's a great idea. I could help with the front end.