devlooped / devlooped/WhatsApp

Add simple mechanism to generate TTL-like tokens for flows

Open
#283 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
13
Forks
3
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the flow-based CallToAction entry points and the existing token handling; the issue names no files or tests. Determine the intended TimeSpan-based TTL behavior and overload scope, then verify that generated tokens stop continuing a flow outside the selected time window.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.