Ideas on how to build a one-time invitation link that expires after being used?

Hey all!

I’m want to make a one-time friend invitation link that will expire after the friendship was created

I’m building a Priavte friend request system that will enable people to add friends only if they recieved a specific friend request. There will be no search engine. The only way to add a friend will be to send an invitation

Now I want to make sure that these links will expire after being used, so they wont be a chance they get passed around and being reused

I’m trying to think about ideas on how to do this

Any ideas?

Thanks!

You could consider introducing an additional data type for friend requests. When someone accepts a request, just delete the data for that particular request, which would naturally invalidate the invite.

Alternatively, if you’d rather not add another data type, how about creating a ‘valid’ datatype that operates on a simple yes/no basis? Once an invite gets accepted, you could switch the ‘valid’ status from ‘yes’ to ‘no’. It’s a simple tweak, but it could do the trick!

That’s a good idea

I would want the link to open a page with the inviation loded into it, so when the users enters the link he sees an entire page dedicated to the invitation, and after he approve the invitation expires and the page wont load it again

So another question, can I create a link to a page with a specific “thing” preloaded into the URL?

I have a simpler idea, but I’m not 100% sure if it will work…
Create a data type called invitation with a data called (valid time) type date

Then set the Privacy set to this invitation only be visible if the date >= current time.

To connect the invitation to the page, the best way is through “slug”… it’s like a “unique id” but for url paremeters. You need to create a unique slug for every invitation to create, but it’s a way to search it when the link is clicked

(I’m not sure if it works only with privacy, but try out)

1 Like

Easy done :slight_smile:
You can make a page dynamic in value, check out this article Page Element - Bubble Docs

Pretty much, setup a page called invite for example, then when user clicks accept make changes to a thing (That thing being current pages invite) and that would be either render it no longer valid or just delete a thing (That thing being current pages invite) .

1 Like

Ok great, so that is the solution!

A unique data type for invitations which will be loaded into a page. The invitation link will lead to the page with the specific invitation based on the invitation’s slug. In the page the user will be able to accept/decline the invitation, which will in turn make the invitation not-valid and will disable the link

Thanks for the advices!

1 Like