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

Integrated unsubscribe in SMS shortlinks #1914

Open
6 tasks
jace opened this issue Oct 27, 2023 · 0 comments
Open
6 tasks

Integrated unsubscribe in SMS shortlinks #1914

jace opened this issue Oct 27, 2023 · 0 comments
Assignees

Comments

@jace
Copy link
Member

jace commented Oct 27, 2023

After #1741, full unsubscribe links in the form https://bye.li/<token> are not being used in SMS templates as there is a limit on the number of variables (2, stretching to 3). We're using the naked https://bye.li/ instead, which (a) requires the user to login, and (b) offers no hint of which notification was received. This is hostile and has led to users reporting messages as spam within their messaging apps.

Separately, Google Messages only shows a link preview when the message contains a single link. (Some references require the link to be at the very end of the message, which is a problem if the DLT system insists on suffixing the message with the brand name. This should be verified.)

We can solve both problems (template variable count, link preview) by changing our links to this form: https://has.gy/<link_token>/<unsubscribe_token>. In a template it will appear as "See details or stop notifications: https://…".

Changes required:

  1. Change the shortlink view (in funnel.views.shortlink) to add /<name>/<token> as a route, with the current route getting defaults: {'token': None}. Within the view, if the token is specified, it will reparse the URL, add unsubscribe_token=<token> as a URL parameter and perform the redirect (@jace)
  2. A new before_request handler will look for this unsubscribe_token in all GET requests, and will validate it (optional?) and render a flash message with a link to the unsubscribe page. This handler cannot strip it from the URL and issue a redirect (as the current unsubscribe link does) because redirects will affect link preview. (@jace)
  3. Flash messages are currently assumed to be plain text. We need to verify that Markup can be included and renders correctly. (@jace)
  4. Optional: In layout.html.jinja2, look for unsubscribe_token in the request args and use the History API to rewrite the URL to remove it (@vidya-ram)
  5. Change Python templates and RenderNotification.sms_with_unsubscribe() to use {url}/{unsub} format (@jace)
  6. Re-register all SMS templates with updated text (@djamg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants