Skip to content

Add simple mechanism to generate TTL-like tokens for flows #283

@kzu

Description

@kzu

A flow's token is used to resume previously started flows. If a subsequent CTA for the same flow with the same token is received, WhatsApp will consider it a continuation of a previously started one and potentially present partially filled data to continue.

Developers might want to limit that time (defaults to no TTL, basically unless an actual token is provided), so a convenience TimeSpan-based approach can be provided.

It can be as simple as a time bucket such as:

long seconds = DateTimeOffset.UtcNow.ToUnixTimeSeconds() / 60;  // use minutes
long window = (long)TimeSpan.FromDays(3).TotalSeconds / 60;        // minutes too
long bucket = (seconds/ window);

Since flows under a minute of TTL are really impractical (users won't have time to even complete one in that time, so continuing for longer time seems reasonable), we turn seconds to minutes so the resulting bucket number is smaller. 3 days is also something mentioned even in the docs.

Perhaps this should be an overload of CallToAction(...) for the flow-based overloads?

Back this issue
Back this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions