dev-rroslan

dev-rroslan

Hi,

I am trying to create a magic link to a targeted survey.

An agent will create a magic link and message the link to the targeted survey takers.

Any advice is much appreciated. Thank you.

Showing Posts 1 to 6

codeanpeace

codeanpeace

Just to clarify, by magic link, you’re referring to links that offer passwordless authentication and, in your case, automatically redirects a survey taker to the appropriate target survey, right?

If so, take a look at these two articles on how to implement passwordless authentication:

https://dennisreimann.de/articles/phoenix-passwordless-authentication-magic-link.html

At a high level, I imagine the token embedded in the url will need to capture at minimum two identifiers:

  1. an invited survey taker identifier e.g. email, phone number, or database id/uuid
  2. a survey identifier for the redirect.

A potential gotcha is that the survey taker identifier will not be sufficient for situations where the a person is sent multiple targeted surveys through the same identifiers – hence the survey identifier in addition to the survey taker identifier.

Off the top of my head, some questions/requirements to consider:

  • Do you need to create actual user accounts for invited users? And if so, when? e.g. ahead of time, upon first login, upon survey submission?
  • Are magic links sent via email and/or text message? How do you handle messages that bounce back? Do you need to surface them to the survey creator?
  • Should the magic links expire? If so, based on what? e.g. time, after being accessed, after survey submitted?
  • Can survey takers re-visit surveys and edit their answer?
  • Will the survey creator want to see analytics on which survey takers have (not) opened the link, (not) started the survey, (not) completed the survey? If so, you’d want to implement some form of tracking.
dev-rroslan

dev-rroslan OP

The survey takers would not need to login

The survey agent who is logged in visits the survey taker and create a uuid, a redirect and the magic link to a survey, so the link is good for 15 mins and one time use.

The output will be the url, which is copied and pasted in message.

The survey takers can do the survey in the browser.

Thank you. I hope it is possible

dev-rroslan

dev-rroslan OP

or instead of uuid, could be a hidden input field for phone number, jf it is accessible>Could it?

D4no0

D4no0

Just use a JWT token with specific audience, you could even encode more necessary data inside. The signature is done by the private key you have on your server, so you can ensure that the token was emitted by you and is valid.

You can receive the token in any of your endpoints as a param:
https://my.app/survey?token={your_jwt_token}

codeanpeace

codeanpeace

Phoenix has a built-in module Phoenix.Token for creating, signing, and verifying tokens that is worth checking out. It’s also used in both the links shared earlier, I’d give them a read even if you don’t need to login the survey taker.

By “survey agent”, are you referring to the person owning/creating the survey? And that this interaction happens in person?

And is the uuid the identifier representing the survey?

dev-rroslan

dev-rroslan OP

Most of the time we need a survey agent who can sign in using the mix phx.gen.auth. We need the survey agents because most of the time we need good survey samples.

From what I understand from above conversations, the survey agents will login and create a magic link, using token and a redirect by creating a token module.

Token should not be in db, active for 15 mins.

I think that’s what I need. Any comments is welcome.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews