Phone Providers
Connect a Telnyx or Plivo account so its numbers can become phone aliases that forward and send texts through your WorkerMailmask itself, running on your Cloudflare account.
Why Use This Setup?
- Lets the CLI search for, buy, and release numbers so you never copy numbers between dashboards.
- Checks the webhook signatureProof a request really came from the provider on every text so nobody else can post fake texts to your Worker.
- Points every number at the Worker on each deploy so a new phone aliasA rented number that forwards its texts to you works without dashboard clicks.
Requirements
- A provider account with funds — Buying numbers and sending texts, forwarded or your own, are billed by the provider.
- A deployed Worker with its custom domain — Providers post texts to
https://<base_domain>/phone/<provider>/messages, as Deployment sets up. - Number registration where your country needs it — In the United States, texting from local numbers usually needs a 10DLC campaign, and toll-free numbers need verification. Each provider handles this in its own dashboard.
Telnyx
Get the Credentials
- In the Telnyx portal, open Keys & Credentials and create an API key.
- On the same page, copy the Public Key. It's the base64 key Telnyx signs webhooks with, not the API key.
Add the Account
mm phone provider add-telnyx telnyx --api-key KEYxxxxxxxx --public-key "base64-public-key"
mm phone provider check telnyx
Destination Countries
Telnyx lets a messaging profile text only the countries you list. Mailmask leaves every country open by default, and --countries US,CA on add-telnyx, or destination_countries in config.json, narrows it on the next deploy.
What Deploy Sets Up
- Messaging profile — Deploy creates a
Mailmask (telnyx)messaging profile on the first run, saves its ID asmessaging_profile_id, and keeps its webhook URL pointed at/phone/telnyx/messagesand its destination countries in step with the config. - Numbers — Every phone alias number on the account is assigned to that profile.
- Signatures — The Worker checks the
telnyx-signature-ed25519header over thetelnyx-timestampheader and the raw body, and refuses timestamps more than five minutes from its clock.
Plivo
Get the Credentials
- In the Plivo console, copy the Auth ID and Auth Token from the account overview.
- Keep the token private. Plivo uses it both for API calls and to sign webhooks.
Add the Account
mm phone provider add-plivo plivo --auth-id MAxxxxxxxxxxxxxxxxxx --auth-token "auth-token"
mm phone provider check plivo
Destination Countries
Plivo sets the countries an account may text under Messaging > Settings > Geo Permissions in its console, and its API has no way to change them. Texts to a country that isn't turned on there are refused, and the phone alias texts you the reason (Plivo docs). Deploy prints a reminder about this whenever the config has a Plivo account.
What Deploy Sets Up
- Application — Deploy creates a
mailmask-plivoapplication on the first run, saves its ID asapplication_id, and keeps its message URL on/phone/plivo/messageswith content logging off. Plivo requires an answer URL too, so it gets the same address, whose empty answer ends any call. - Numbers — Every phone alias number on the account is linked to that application.
- Signatures — The Worker checks
X-Plivo-Signature-V3with theX-Plivo-Signature-V3-Nonceheader, an HMAC-SHA256 of the URL and the sorted form fields keyed by your auth token.
Usage
# Find, buy, and forward a number in one go.
mm phone search telnyx --country US --area-code 555
mm phone add +15550100100 --provider telnyx --destination personal --buy --yes
# Apply it, which also points the number at the Worker.
mm deploy
# Point the numbers again without a full deploy.
mm phone provider connect
warning
Provider credentials are stored in config.json and copied to .wrangler/mailmask/config.json for bundling into the Worker, just like notifier tokens. Keep both paths out of version control.
Troubleshooting
- Texts never arrive — Run
mm phone provider connect, then check that the custom domainYour Worker's own web addresses on the base domain is attached, since deploy only warns when it can't attach one. - The provider reports
401from the Worker — The saved public key or auth token doesn't match the account. Copy it again and deploy. - Texts fail with a
4xxfrom the provider — The number may still need 10DLC or toll-free registration, the account may need funds, or the destination country may not be allowed.