GDPR-Compliant Healthcare & Enterprise SMS: Data Sovereignty, Retention Limits, and European Direct Routes
A practical GDPR architecture for SMS: Article 6 and 9 bases, 30-day retention, Article 28 DPAs, Schrems II transfers, and a compliant STOP workflow.
The retention schedule said thirty days. The data lake said fourteen months. That was the entire finding of the supervisory authority's preliminary inquiry into a Berlin healthtech company, and it did not matter that the SMS bodies contained no patient names. Each row held an E.164 number, a clinic identifier, an appointment timestamp, and a message that began with the words "your oncology follow-up." A phone number plus a clinic plus a date is a patient record wearing a disguise.
The company had done the visible work. It had a privacy policy, a cookie banner, and a data-processing agreement filed somewhere in legal. What it did not have was an architecture that made the policy true. The SMS gateway stored message bodies in a US data warehouse, the CRM copied them into a support tool, and the backup vendor kept a third copy in a region nobody had mapped. Three systems, three retention clocks, one data subject access request that exposed all of them.
Is an SMS message personal data if it contains no name?
Yes. An SMS is personal data under GDPR Article 4(1) because the E.164 number identifies a natural person, and the body, sender ID, timing, and delivery metadata can reveal health, location, relationships, or authentication activity. A compliant program needs a lawful basis under Article 6 (and Article 9 for health data), a data-processing agreement under Article 28, storage limitation under Article 5(1)(e), and a valid transfer mechanism under Articles 44β46 if any processor or storage sits outside the EEA. The message body is usually the least important part of the dataset; the metadata is the map.
Most SMS compliance guides focus on consent. Consent is one basis out of six, and for transactional messages it is usually the wrong one. A login OTP is not marketing; it is performance of a contract with the data subject. An appointment reminder is a healthcare service, which may bring Article 9 into play. A promotional SMS requires consent under both GDPR and the ePrivacy Directive, plus national implementing law. Treating every message as a marketing message produces a consent flow that is simultaneously over-engineered for OTPs and under-engineered for health data.
The data you are actually processing
Start with a data map, not a policy template. An SMS pipeline typically touches more personal data than the product team realizes: the destination number, the message body, the sender ID, the delivery receipt, the originating IP, the webhook payload, the consent record, and the invoice. Each element has a different sensitivity, a different lawful basis, and a different retention period. Lumping them into one "message log" with a single 12-month retention rule is how companies end up deleting evidence they need for tax and keeping health data they do not need at all.
| Data element | Personal data? | Sensitivity | Suggested retention | Why you keep it |
|---|---|---|---|---|
| MSISDN (E.164) | Yes | Identifier | Relationship + 3 years | Routing, consent, suppression |
| Message body | Yes; may be Art. 9 | High | 0β30 days | Delivery, dispute, retry |
| Sender ID | Usually | Low | 30β90 days | Brand attribution, abuse review |
| DLR status | Yes, linked | Medium | 90 days | Billing, SLA, carrier disputes |
| Timestamps / IP | Yes | Medium (behavioral) | 30β90 days | Fraud, security, latency |
| Consent record | Yes | Medium | Relationship + 3 years | Accountability under Art. 5(2) |
| Invoice / tax record | Business contact | Low | 10 years (typical) | Tax and audit obligation |
Suggested periods only; align with your sector, member-state law, and statutory record-keeping duties.
Lawful basis: Article 6 is not a checkbox
Article 6 requires one of six lawful bases, and the choice must be documented before processing begins. For SMS, four bases cover almost every legitimate use case: consent for marketing, contract for authentication and transactional notifications, legal obligation for certain regulated notices, and legitimate interests for security or fraud prevention. Article 9 adds a second gate for health data, and the healthcare provider β not the SMS vendor β is usually the controller that must satisfy it.
| Use case | Lawful basis | Consent needed? | Retention |
|---|---|---|---|
| Login OTP / 2FA | Art. 6(1)(b) contract | No marketing consent | 30 days |
| Appointment reminder | Art. 6(1)(b); Art. 9(2)(h) if health | No, if service-related | 30 days |
| Promotional campaign | Art. 6(1)(a) + ePrivacy Art. 13 | Yes, explicit opt-in | Until withdrawal |
| Payment failure alert | Art. 6(1)(b) or (c) | No | 90 days |
| Prescription ready | Art. 9(2)(h) healthcare | No, if service-related | 30 days, neutral copy |
| NPS / feedback survey | Art. 6(1)(f) or (a) | Depends on channel and content | 30 days |
Legitimate interests is not a magic wand. It requires a three-part assessment: a genuine interest, necessity of the processing, and a balancing test against the data subject's rights and expectations. An OTP delivery message can usually rely on contract. A "we think you might like this" campaign cannot. If the message's purpose is persuasion rather than service, assume consent is required and build the opt-in flow accordingly.
ePrivacy and the national rules that actually get enforced
GDPR is the floor, not the whole building. The ePrivacy Directive (2002/58/EC) governs unsolicited electronic communications, and each member state implements Article 13 differently. Germany's UWG Β§7 requires prior express consent for SMS advertising and recognizes a narrow soft opt-in for existing customers. France's CPCE Article L34-5 requires prior consent and imposes specific information duties. Italy's Garante has repeatedly fined companies for SMS campaigns without valid consent records. A campaign that is lawful in one member state can be unlawful in the next.
The soft opt-in is narrower than most growth teams assume. It typically requires that the contact details were obtained in the context of a sale, that the message concerns similar products or services, that the recipient was given a clear and free opportunity to object at collection and in every message, and that the sender is the same legal entity. It does not authorize buying a list, scraping numbers, or importing a partner's database. When in doubt, collect affirmative consent and keep the proof. Our GDPR SMS consent wording guide includes copy that satisfies the information and withdrawal requirements.
Record-keeping matters as much as consent. Store the timestamp, source, exact wording, IP address, and channel of every opt-in. Under Article 7(1), the controller must be able to demonstrate that the data subject consented. A database column that says marketing_opt_in = true without any of that context is not proof.
Retention: the 30-day rule that survives an audit
Storage limitation is the principle most companies fail in practice, because deleting data feels like losing value. The defensible pattern is to separate the message content from the delivery record. You need the body long enough to retry a failed send, investigate a complaint, or prove what was sent. You rarely need it for a year. Delivery metadata, by contrast, has a legitimate billing and security purpose for 90 days, and consent records must live for as long as the relationship plus the statute of limitations. For a field-by-field breakdown of what a gateway actually stores, see what a gateway stores about an OTP.
A retention job should do three things: null or delete message bodies after the short window, delete or aggregate delivery rows after the medium window, and preserve records subject to a legal hold. Cryptographic erasure is a useful pattern for bodies: encrypt each body with a per-message key, store the key separately, and delete the key when the retention period expires. The ciphertext becomes unreadable without touching every backup. Pseudonymizing the number with an HMAC keyed by a secret is better than a plain hash, which is trivially reversible for a 10-digit phone number.
import hashlib, hmac, os
from sqlalchemy import text
def purge_expired_messages(conn) -> None:
# 1. Remove the content, keep the delivery evidence.
conn.execute(text("""
UPDATE sms_messages
SET body = NULL,
body_key_id = NULL,
purged_at = now()
WHERE created_at < now() - interval '30 days'
AND body IS NOT NULL
"""))
# 2. Delete the metadata after the billing/dispute window.
conn.execute(text("""
DELETE FROM sms_messages
WHERE created_at < now() - interval '13 months'
AND legal_hold = false
"""))
def pseudonymize(msisdn: str) -> str:
key = os.environ["PSEUDONYM_KEY"].encode()
return hmac.new(key, msisdn.encode(), hashlib.sha256).hexdigest()
# A pseudonym is still personal data under GDPR. Use it for analytics,
# not as a substitute for deletion.
Article 28: the DPA is not a PDF you file and forget
If an SMS gateway processes personal data on your behalf, it is a processor and you need a written contract under Article 28. The contract must describe the subject matter, duration, nature and purpose of processing, the type of personal data, the categories of data subjects, and the processor's obligations. It must also authorize sub-processors in writing, impose equivalent data-protection terms on them, require confidentiality, assist with data-subject requests, notify breaches without undue delay, and delete or return data at the end of the service.
The operational question is not whether the DPA exists, but whether it matches the architecture. If the gateway stores message bodies in a US region, the DPA must disclose that sub-processor and the transfer mechanism. If it retains logs for 18 months, the DPA's retention clause must say so. If it uses a third-party analytics tool that sees phone numbers, that tool is a sub-processor and belongs on the list. Ask for the current sub-processor list and a notification commitment before you sign.
SMSRoute operates an EU point of presence in Frankfurt and makes a Data Processing Addendum available on request, with SCCs incorporated by reference for EU transfers. Confirm in the DPA which data is stored in which region, which sub-processors can access it, and how deletion works at contract end. The network itself is different: an SMS to a German handset necessarily transits German carrier infrastructure, and no provider can promise that the radio path stays inside one jurisdiction. What can be kept in the EU is the storage and processing layer β the database, the logs, the webhook payloads, and the backups. Be precise about which boundary you are contracting for.
International transfers after Schrems II
The CJEU's Schrems II judgment (Case C-311/18) invalidated the Privacy Shield and confirmed that an adequacy decision is not a blanket permission slip: the exporter must assess whether the destination country's law and practice provide essentially equivalent protection, and add supplementary measures where they do not. The European Data Protection Board's Recommendations 01/2020 set out the six-step transfer impact assessment that supervisory authorities expect to see.
| Transfer mechanism | When it applies | Practical caveat |
|---|---|---|
| Adequacy decision (Art. 45) | UK, Switzerland, Japan, South Korea, Canada, EU-US Data Privacy Framework | Verify the recipient is actually certified under the DPF; adequacy can be challenged |
| Standard contractual clauses (Art. 46) | Most controller-to-processor transfers outside the EEA | 2021/914 modules; requires a documented TIA and supplementary measures |
| Binding corporate rules (Art. 47) | Intra-group transfers in multinationals | Lead-authority approval; 12β18 month implementation |
| Article 49 derogations | Occasional, non-repetitive, necessary transfers | Not a lawful basis for systematic SMS processing at scale |
For an SMS program, the practical goal is to minimize the transfer surface. Store message bodies and DLRs in an EU region. Keep webhook processing in the EU. If a US-based parent needs analytics, send aggregated counts rather than phone numbers. If a sub-processor must see numbers, document the SCC module, the TIA, and the supplementary measures β encryption at rest with keys held in the EU, pseudonymization before transfer, and a government-access policy that is actually enforced. A DPA that says "we comply with SCCs" without a TIA is a promise, not a transfer mechanism.
Healthcare overlays: EHDS, NIS2, and professional secrecy
Healthcare messaging sits at the intersection of GDPR, sectoral law, and security regulation. Article 9(2)(h) permits processing necessary for medical diagnosis, the provision of health or social care, or the management of health systems, provided the processing is carried out by or under the responsibility of a professional subject to professional secrecy under Article 9(3). That is the provision a hospital relies on for appointment reminders β not marketing consent, and not legitimate interests.
The European Health Data Space Regulation (EU) 2025/327 entered into force on 26 March 2025, with key provisions applying from 2029. It adds patient-access and interoperability obligations for electronic health record systems; it does not replace GDPR, and it does not authorize SMS providers to process health data without a lawful basis. NIS2 (Directive (EU) 2022/2555) brings health-sector entities into a broader cybersecurity regime with supply-chain security duties. ISO 27799 provides the health-specific information-security controls that auditors expect to see.
The cheapest compliance control is message copy that reveals less. "Reminder: your appointment is confirmed for 14 November at 09:30. Manage or cancel: [link]" delivers the service without naming a department, a diagnosis, or a clinician. "Your oncology follow-up is confirmed" turns a routine reminder into special-category data on a lock screen. Use neutral language, put sensitive details behind an authenticated link, and never include test results or medication names in the body.
A compliant opt-out workflow
Article 21 gives data subjects the right to object, and ePrivacy requires a free and easy way to stop receiving marketing messages. In practice, the STOP keyword is the most important interface your compliance program has. It must work across every inbound channel, take effect immediately, propagate to the CRM and the suppression list before the next campaign, and leave an audit trail that proves when and how the request arrived.
The handler below verifies the gateway signature, normalizes the keyword, writes an idempotent suppression record, and appends an audit entry. It deliberately does not rely on the CRM being available: suppression happens in the messaging path, so a downstream outage cannot cause a second marketing send to someone who already opted out.
import hashlib, hmac, os, sqlite3, time
from flask import Flask, jsonify, request
app = Flask(__name__)
DB_PATH = os.environ.get("SUPPRESSION_DB", "suppression.db")
STOP_WORDS = {"STOP", "STOPALL", "UNSUBSCRIBE", "OPTOUT", "CANCEL"}
def db():
conn = sqlite3.connect(DB_PATH)
conn.execute("""CREATE TABLE IF NOT EXISTS suppressions (
msisdn TEXT PRIMARY KEY, reason TEXT NOT NULL, created_at INTEGER NOT NULL)""")
conn.execute("""CREATE TABLE IF NOT EXISTS audit_log (
id INTEGER PRIMARY KEY AUTOINCREMENT, message_id TEXT, msisdn TEXT,
action TEXT, created_at INTEGER)""")
return conn
@app.post("/webhooks/sms/inbound")
def inbound():
raw = request.get_data()
signature = request.headers.get("X-SMS-Signature", "")
expected = hmac.new(os.environ["SMS_WEBHOOK_SECRET"].encode(),
raw, hashlib.sha256).hexdigest()
if not hmac.compare_digest(signature, expected):
return jsonify(error="invalid signature"), 401
event = request.get_json(force=True)
keyword = event.get("text", "").strip().upper()
if keyword not in STOP_WORDS:
return jsonify(status="ignored"), 200
now = int(time.time())
conn = db()
try:
conn.execute(
"INSERT OR IGNORE INTO suppressions (msisdn, reason, created_at) VALUES (?, ?, ?)",
(event["from"], "sms_stop", now),
)
conn.execute(
"INSERT INTO audit_log (message_id, msisdn, action, created_at) VALUES (?, ?, ?, ?)",
(event.get("message_id"), event["from"], "suppressed", now),
)
conn.commit()
finally:
conn.close()
return jsonify(status="suppressed"), 200
Two details are easy to miss. First, suppress the number against future campaigns, not just the current one; a flag scoped to a single campaign is how opted-out users get re-messaged next quarter. Second, honor the request across channels and identifiers. If the same person has two phone numbers, a STOP from one should trigger a review of the other, or at least a suppression on the shared customer record. GDPR's right to object is not channel-specific.
The DPIA checklist
A data protection impact assessment is required when processing is likely to result in a high risk to rights and freedoms β which is almost always the case for health data at scale, systematic monitoring, or a new technology. Article 35(7) requires a description of the processing, an assessment of necessity and proportionality, an assessment of risks, and the measures envisaged to address them. For an SMS program, the checklist below covers the questions an auditor will ask.
- 01What is the purpose of each message type, and which Article 6 basis supports it?
- 02Does any message reveal health, religion, sexual orientation, or another special category? If yes, which Article 9 condition applies?
- 03Where are message bodies, DLRs, consent records, and backups stored? Which countries are involved?
- 04What is the retention period for each data element, and what job enforces it?
- 05Can a data subject exercise access, rectification, erasure, and objection without contacting engineering?
- 06Which sub-processors see personal data, and how are they bound by Article 28 terms?
- 07What is the breach-detection and 72-hour notification procedure?
- 08What happens to data when the contract ends β deletion, return, or archival?
Frequently asked questions
Do I need consent to send OTP SMS?
Usually not, if the OTP is necessary to perform the contract the data subject requested, such as logging into an account they created. That falls under Article 6(1)(b). If the OTP is bundled with marketing consent, separate the two: the login code should not be conditional on receiving promotions. Document the purpose and keep the authentication logs to the minimum needed for security.
Is a phone number personal data if we hash it?
A plain hash of a phone number is still personal data because the input space is small enough to enumerate. A keyed HMAC with a secret held separately is pseudonymization, not anonymization; the data remains in scope of GDPR. True anonymization requires that re-identification is impossible with all means reasonably likely to be used, which is a high bar for communication metadata.
Can we store message bodies in the US?
You can, if you have a valid transfer mechanism and a documented transfer impact assessment. For most EU controllers, that means SCCs plus supplementary measures, or a US recipient certified under the EU-US Data Privacy Framework. For health data, the risk assessment is harder to satisfy and EU residency is the simpler path. The transfer mechanism must cover every sub-processor that can access the data, not just the primary vendor.
How long can we keep delivery logs?
Long enough for billing disputes, security investigations, and any statutory obligation, and no longer. A 90-day window for DLR metadata is common; invoices may need ten years depending on tax law. The key is to separate the retention period for content from the period for metadata, and to enforce both with an automated job rather than a policy document.
Jacky Hossein
Verified AuthorPrincipal Telecommunications & Cryptographic Systems Architect at SMSRoute. Specializes in carrier-grade SS7/SMPP routing protocols, non-custodial cryptocurrency billing rails, and zero-knowledge telecommunications privacy.
Send Global SMS in Under 60 Seconds Without KYC
Sign up with email only. Top up with Bitcoin, USDT, Monero, or Ethereum. Instant carrier interconnects to 149 countries from $0.004/msg.