ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

WebSocket or notification endpoint to update content in AMP Email that a user currently has open #39784

Open hach-que opened 9 months ago

hach-que commented 9 months ago

Description

Apologies if there's a way to do this, but it didn't look like it from the documentation.

What I would like to do is have a QR code in an email (probably an amp-img) where the src is loaded from a remote server. Then, when our system detects that the QR code has been scanned, it can send a notification or WebSocket push so that the amp-img source is replaced with a green check or other kind of indicator. This would help users have immediate feedback as to when their QR code has been scanned successfully.

Alternatives Considered

Without being able to live update content in response to a notification, we'd probably just have to link out to a website from the email content (where we could then use React to replace the content in response to the WebSocket notification).

Additional Context

No response

erwinmombay commented 9 months ago

@hach-que have you tried using amp-list?

hach-que commented 9 months ago

@erwinmombay I haven't tried using an amp-list, but I couldn't see anywhere that an amp-list could be signaled to be updated once the email is open. i.e. I know I can get an amp-list to fetch the content when the email is first opened, but I couldn't see a way of telling the email client to reload the list based on an event that happens on an external server.

I thought about doing long polling, but I suspect that probably won't work the way I want due to email clients proxying requests.

Vue-Pu commented 9 months ago

Might be able to using Gitbook

https://docs.gitbook.com/integrations/overview