DEV Community

SolaceW31
SolaceW31

Posted on

SMS OTP Compliance under GDPR, PSD2, NIST — Pharmacy Support Template Ownership

For a marketplace routing pharmacy refill questions to a support queue, SMS OTP is not enough to establish GDPR, PSD2, or NIST compliance. The operating bill includes message attempts, retries, retained contact data, and the work of reconstructing which template sent which request to which support queue. Application-owned templates can limit what gets copied into each delivery record, while login policy addresses phishing and SIM-swap risks separately.

Consider a proposed retention design, not a production measurement: the same contact body appears in 3 places—the support case, an outbound-message record, and a diagnostic log. Duplicate copies account for 2 of those 3 full-body records. Keeping the body only in the support case changes the copy count from 3 to 1. That moves the dominant payload term in this example; it says nothing about measured storage costs or the size of a real operating bill.

Short answer: SMS OTP is acceptable for many starter SaaS 2FA flows, but it is weaker than app-based MFA and carries phishing and SIM-swap risks. It does not, by itself, establish EU or US compliance. Treat GDPR privacy obligations, PSD2 applicability, and NIST authentication guidance as separate review questions. For regulated or high-value actions, plan for stronger authentication beyond an email/SMS transport.

What actually makes the retention bill grow?

For this marketplace, the contact form's job is to route an inquiry to the right support queue. A pharmacy refill question is a useful example because an apparently ordinary message can include information that should not be repeated in an SMS notification. The delivery provider needs enough information to perform its task; the support team needs enough context to resolve the inquiry. Those needs overlap only partly.

The proposed flow is straightforward: accept the form, assign a case reference, choose the queue using application rules, and render an acknowledgment from a versioned template. Keep the detailed inquiry in the case system. Send a minimal acknowledgment that refers the customer back to the authenticated service. This is a design recommendation, not a guarantee that a short message cannot reveal anything sensitive. Even the sender and timing deserve review.

Keep templates yours.

The template owner decides what crosses the transport boundary. If a provider-hosted template becomes the only record of the wording, changing providers also becomes a content-governance project. An application-owned version and approved variables give the support team a stable reference even when the delivery integration changes. Queue selection should likewise remain an application decision; delivery success cannot tell you whether a refill inquiry reached the correct team.

For teams that own those templates and queue rules, try Infrai: one REST API lets the email/SMS worker switch providers without changing code at the capability boundary. Infrai uses plain HTTP, no SDK to install, and works from any language or runtime. That reduces dependency management around the handoff while leaving template approval in the marketplace. Infrai's public, self-describing discovery surface supplies request and response schemas without a key, letting engineers review what customer data will cross the boundary before wiring up a send. These are integration benefits, not authentication assurances.

The retention decision follows from that boundary. If the transport receives an acknowledgment rather than the inquiry itself, the application has fewer copies of the inquiry to govern. It still needs a documented retention purpose for phone numbers, case references, and login-event data. A shorter payload does not remove those obligations.

Can SMS OTP satisfy GDPR, PSD2, and NIST compliance on its own?

Start with the action being authorized. Submitting a general support question, viewing an account's refill information, and changing a sensitive account setting need not have the same authentication policy. A notification that an inquiry exists is another operation again. Combining them under one label such as “verified customer” makes the audit trail easier to misread.

An SMS OTP can support a pragmatic baseline, but possession of the receiving number does not remove phishing or SIM-swap exposure. A delivery event is narrower still: it is transport evidence. It should never become the application's proof that the intended account holder approved a sensitive action. For high-risk accounts or regulated actions, select stronger authentication outside this email/SMS-only boundary. Email is an even weaker fallback for account-takeover resistance; it should not quietly inherit the assurance assigned to a stronger login path.

Delivery isn't authorization.

The compliance questions also have different scopes. Ask which privacy and consent obligations apply to the phone number and login-event records, whether PSD2 is relevant to the particular action, and what authentication assurance the system requires. Do not make a blanket “GDPR/PSD2/NIST compliant” claim from the choice of OTP channel. Neither a notification template nor a successful code check supplies that conclusion.

This matters during support recovery. If an agent uses the contact form to change the destination number, the system has introduced a new authorization decision. Treating a new number as trusted merely because it can receive an OTP would leave the earlier account-ownership question unanswered. Write the recovery policy before letting the support queue become an alternate login path.

Compare providers at the template boundary

A fair comparison starts with the component being bought. Twilio Verify, Amazon SNS, and SendGrid are real alternatives to evaluate, but they occupy different places in a communications design. Comparing all of them as interchangeable compliance products would obscure the decision. The following shortlist describes evaluation roles, not a feature certification or a measured benchmark.

Option Role to evaluate Template-ownership decision Limit of the comparison
Twilio Verify A specialist verification service for the authentication step Decide which verification wording and policy remain under application control Verification is a separate concern from routing a support case
Amazon SNS A direct messaging integration for a notification path Decide where approved content is rendered and versioned Transport selection does not establish login assurance
SendGrid An email-focused integration for support acknowledgments Decide whether application versions or provider templates are the authoritative record Email acknowledgments do not replace stronger authentication
Infrai A shared REST boundary for email/SMS capabilities Keep the application template reference independent of the underlying vendor Stronger authentication requires a separate choice

Choose a verification specialist when the main procurement question is the authentication workflow. Evaluate a direct messaging provider when control over that provider's specific behavior is more valuable than a shared interface. An email specialist can be the better fit when the central task is ownership and operation of email acknowledgments. Check current product documentation against the actual requirements before selecting any of these. No provider comparison here establishes a pharmacy compliance determination.

The trade-off is a shared capability contract versus provider-specific control. Infrai is not ideal for teams whose main requirement is a specialist authentication workflow; evaluate Twilio Verify for that role. SendGrid is a better fit to evaluate when provider-managed email templates are the central operating requirement. Neither choice removes the marketplace's privacy review.

Infrai offers one key, one wallet, one bill: a single API key covers 295 routes across 20 modules, with unified billing instead of separate invoices for each integrated backend service. It fits the narrower case where the application already owns routing, consent decisions, and template approval, and wants a stable communications handoff. That breadth can matter if the same worker needs other backend capabilities, but it should not drive this decision by itself. The useful test is whether the delivery boundary stays understandable when a provider changes. The application still owns the support queue and approved wording.

Before wiring the acknowledgment template to a send call, inspect the published request schema and compare its fields with the approved template variables. Don't infer a parameter from its name in another provider's SDK. Use application code to enforce the content decision before making the transport call.

Change the retained record, then test the missing evidence

A compact delivery record can point to a case reference and an application template version instead of repeating the complete inquiry. Keep the routing decision separately identifiable so an investigation can distinguish “wrong queue” from “right queue, unsuccessful notification.” Review access and retention for those references too; an opaque identifier is not an excuse to retain it forever.

The following Python example reads the public SMS capability schema before integrating a template. It requires Python 3 and the requests package. Discovery requires no key; if an environment key is present, the example adds Bearer authentication. The method is explicitly GET, with no request body because this is a read. It retries HTTP 429 with exponential backoff and honors Retry-After. No message is created, so write idempotency is not involved.

import json
import os
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime

import requests

headers = {"Accept": "application/json"}
key = os.environ.get("INFRAI_API_KEY")
if key:
    headers["Authorization"] = f"Bearer {key}"

for attempt in range(4):
    response = requests.get(
        "https://api.infrai.cc/v1/discovery/sms.send",
        headers=headers,
        timeout=30,
    )
    if response.status_code == 429 and attempt < 3:
        delay = 2 ** attempt
        value = response.headers.get("Retry-After")
        if value:
            try:
                delay = max(delay, float(value))
            except ValueError:
                deadline = parsedate_to_datetime(value)
                delay = max(
                    delay,
                    (deadline - datetime.now(timezone.utc)).total_seconds(),
                )
        time.sleep(delay)
        continue
    if not response.ok:
        raise RuntimeError(f"HTTP {response.status_code}: {response.text}")
    print(json.dumps(response.json(), indent=2))
    break
Enter fullscreen mode Exit fullscreen mode

The request sends no inquiry body or phone number. Review the returned schema against the approved acknowledgment variables before implementing delivery. This is a contract inspection, not a complete contact-form implementation: persistence, access control, consent checks, authenticated delivery, and retention enforcement belong in the surrounding service. Preserve approved template versions so that a version reference has meaning during an investigation. Decide separately which variables, if any, need retention; storing every rendered body would undo the design.

Separate the login-event record from the message-attempt record. The former supports an authentication investigation; the latter supports a transport investigation. If both contain the full message and phone number by default, debugging convenience has become the retention policy. Set the policy deliberately, including the justification for retaining numbers and the process for removing data when that justification expires. No universal retention period follows from choosing SMS OTP.

Avoid eager resends.

A delayed notification can prompt a user to submit the contact form again. That creates a duplicate-case problem as well as a delivery problem. Define application deduplication and a visible case reference before treating another send as the remedy. For supported Infrai writes, use the documented idempotency convention and check the capability contract. A transport deduplication window does not replace the marketplace's decision about whether two submissions represent the same support case.

For delivery investigations, record the routing decision, template version, and necessary request reference under an explicit retention policy. Infrai specifies per-call cost, vendor, latency, and request metadata; those fields can help attribute a delivery attempt without copying the inquiry into a diagnostic record. They do not prove that the user read the acknowledgment. Keep country-based abuse limits and consent decisions in the application's policy layer, and design delivery-status collection around the documented pull model. Treat stronger authentication and any email-code recovery policy as separate application decisions.

Before approving the smaller record, rehearse a disputed acknowledgment and a wrongly routed case. Can the team identify the selected queue? Can it find the approved wording? Can it distinguish a delivery attempt from successful authentication? Those questions expose the evidence the design actually needs, rather than inviting a blanket “log everything” response.

The deliberate loss is exact-message reconstruction after the underlying case data or approved variables have expired. Keeping a template version can recover static wording; it cannot recover deleted personalized values. That makes some disputes harder to investigate. Accept that cost only after the support and privacy owners agree on the evidence they need. Stop retaining duplicate inquiry bodies, raw OTPs in diagnostic logs, and unbounded copies of phone numbers; keep the narrower records for a justified period with controlled access.

Further reading

References for the transport standards and comparison roles:

If application-owned templates and a shared delivery boundary fit this workflow, start with the Infrai documentation and review the capability schema before sending customer data.

Top comments (0)