One web app, every subdomain
A SaaS with a subdomain per company needs one app and one key in Takeed.
- Add
https://*.your-saas.comto the app's allowed origins. - Serve the same init code and the same worker file on every subdomain.
- Each subscription records the subdomain it came from; the platform tags the user with
company = <subdomain>. If the app has a branch with that slug, the device joins the branch too.
A new subdomain works immediately, with no setup in the dashboard.
Sending to one company#
{
"app_id": "YOUR-APP-ID",
"contents": {"en": "Your report is ready"},
"filters": [{"field": "tag", "key": "company", "relation": "=", "value": "acme"}]
}or, with branches, "target": "saas:acme", or a branch key for that company.
Relative links ("url": "/reports/7") open on the subdomain the user subscribed from.
Reports can be filtered by company.
Limits set by browsers#
- Permission is asked on each subdomain separately.
- On iPhone, web push works only for sites added to the home screen.
- Custom company domains work the same way: HTTPS, the worker file on that domain, and the domain in the allowed origins.
- A Web Push subscription is not shared between origins; each domain creates its own subscription even for the same signed-in user.