In November 2026 we lost access to a WhatsApp number. It was the support number on several of our products, and it was typed by hand into about 180 pages of a marketing site, into mobile apps already installed on customers' phones, and into print files. Changing it in the code took an afternoon. Changing it on phones that already had the app was impossible until the next store release. This is how we made sure that cannot happen again: one field in an admin dashboard, one public endpoint, and apps that ask for the number instead of carrying it.
TL;DR
- A phone number is configuration, not content. Typed into HTML or an app binary, it outlives the SIM card.
- We keep it in one field in a super-admin dashboard. A public, unauthenticated endpoint returns it as JSON. Websites, apps and print builders all read that endpoint.
- Apps ask on every launch and cache the last answer for offline use. There is no number inside the app, not even as a fallback. Before the first successful fetch, the line is simply hidden.
- The same endpoint picks the number by country: visitors in Egypt see the Egyptian number, everyone else sees the Saudi one. Per-product overrides win over the shared default.
The problem: a number in 181 places
Our POS product ELKASHIER has a static marketing site generated from templates, a Flutter app for Android and iOS, a Windows build, and printed flyers. The support WhatsApp number was in all of them as a literal string. When the number stopped working, we had to find every copy. Two things made that harder than it sounds:
- Search tools lie by omission. Our default
grepis aliased to a tool that skips git-ignored folders, and the generated site and the flyer output live in exactly those folders. The first search found far fewer copies than really existed. We switched to the system/usr/bin/grepfor every "is it anywhere?" question. - Installed apps cannot be searched. Every phone with the app installed keeps showing the dead number on its About page and on printed receipts until the user installs a new version, and that waits on a store review.
Why the usual fixes fall short
A constants file is the first instinct. It solves "181 places" in the source tree, but the value is still compiled into the binary. You have moved the problem, not removed it.
Remote config services solve the binary problem, but add a vendor SDK to every app and a console only developers open. The person who changes a support number is the business owner, and he already has an admin dashboard. It belongs there.
A hard-coded fallback ("fetch it, but if that fails use this one") feels safe and is exactly the trap we fell into. A fallback is a hard-coded number with extra steps. The day it is wrong, it is wrong on every phone that is offline or has not launched since.
The design
- One field. Each product's super-admin settings has a "support WhatsApp" field. Above that sits a shared "general settings" module in our internal projects dashboard, which holds the company-wide numbers for all products: one for Egypt, one for everywhere else.
- One public endpoint per product, for example
/api/public/contact. It returns the number, a display form, and which region it chose. No personal data, no secrets. - Resolution order, in one function on the server: the product's own field if filled; otherwise the shared number for the caller's country; otherwise nothing. Nothing is better than a guess.
- Every client reads it: the static site, the apps, and the build scripts for print.
Picking the country
We do not run a CDN in front of the dashboard, so there is no country header to rely on. The shared module looks the IP up in a local country database (DB-IP Lite, refreshed monthly by another of our services), with an older MaxMind file as a fallback. A signed-in user's phone number beats the IP: a +20 number gets the Egyptian line even when the user is travelling. If nothing is known, it defaults to Egypt, our main market.
// order: known phone → CDN country header (if one is ever added) → IP database → default
function pick({ phone, country, ip }) {
const pr = phoneRegion(phone);
if (pr) return { region: pr, by: 'phone' };
const hc = norm(country);
if (hc) return { region: hc === 'EG' ? 'egypt' : 'intl', by: 'header' };
const ic = lookup(ip);
if (ic) return { region: ic === 'EG' ? 'egypt' : 'intl', by: 'ip' };
return { region: 'egypt', by: 'default' };
}
One consequence is easy to miss: the answer now depends on who asks. A shared cache in front of the endpoint would serve the Egyptian number to a visitor in Riyadh. The product endpoint is therefore marked Cache-Control: private, max-age=300, and products that call the shared module server-to-server pass their own visitor's IP, so the dashboard decides for the visitor, not for the product's server.
The static site
The generated pages still contain a number, because search engines and visitors without JavaScript should see one. But it is only the last build's copy. A small script on every page asks the endpoint and rewrites every tel: link, every wa.me link and every element marked data-contact:
fetch('/cloud/api/public/contact', { credentials: 'omit' })
.then(r => r.ok ? r.json() : null)
.then(c => {
if (!c || !c.whatsapp) return; // keep what the page has
const d = String(c.whatsapp).replace(/\D/g, '');
document.querySelectorAll('a[href^="tel:"]').forEach(a => a.href = 'tel:+' + d);
document.querySelectorAll('a[href*="wa.me/"]').forEach(a =>
a.href = a.href.replace(/wa\.me\/\d+/, 'wa.me/' + d));
});
The site generator also reads the same endpoint, and it refuses to build if the admin field is empty. That turns "someone forgot to set the number" from a silent bug into a failed build.
The apps
This is the part that removes the store from the loop. In the Flutter app, the number comes from a tiny class that reads its cached copy from disk (fast, works offline) and then refreshes from the endpoint in the background:
static Future<void> load() async {
final f = await _cacheFile();
if (f != null && await f.exists()) _apply(jsonDecode(await f.readAsString()));
unawaited(refresh()); // ask the server; on success, overwrite the cache
}
static String get phone => _phone; // '' until the app has been online once
static bool get hasPhone => _phone.isNotEmpty;
There is deliberately no default. The About page and the printed receipt check hasPhone and leave the line out if the app has never been online. A till that connected once keeps the last number it saw. None ever shows a number we baked in months ago.
What we got wrong first
Our first fix after losing the number was the obvious one: replace the old literal with the new literal everywhere. It worked for the website the same day. But the apps already in the stores kept the dead number, and they still carry it until their next release ships. We had fixed the source and left the users. The contact class above came the next day, and the rule became: the number does not live in the code at all, including as a backup.
Result
- The ELKASHIER site's 187 page and template files load the contact script; changing the admin field changes every page on the next load.
- The ELKASHIER apps read the number at launch from the same field, so new app builds will follow a change in the dashboard without another store release. Builds already installed before this change still need one more update; after that, never again.
- 13 of our codebases now read the shared contact module instead of carrying their own copy.
Checklist
- Search your whole tree for the number, with a tool that does not skip ignored or generated folders.
- Put the number in the admin dashboard the business owner already uses. One field per product, one shared default above it.
- Expose it on a public endpoint with no personal data. If the answer depends on the visitor, mark it
private. - In apps: fetch on launch, cache the last answer, and ship no built-in fallback. Hide the line until you have a real value.
- On static sites: keep a copy in the HTML for crawlers, rewrite it at load time from the endpoint.
- Make the build fail when the field is empty.
- Pick by country if you have regional lines, with a known user's phone ahead of the IP.
Need this?
Every product GeoTech builds, from DentX and Krown to ELKASHIER and Curava, ships with its contact details, payment settings and keys managed from one admin dashboard, so the business owner changes them without a developer or a store release. If your apps carry numbers or links that you cannot change today, talk to GeoTech.