Server helpers
Your server does three things for a Nexafon integration, and each helper does each in one call, with no dependencies beyond the language’s standard library:
| Task | Node | PHP | Python | Go |
|---|---|---|---|---|
| Sign a user token | createUserToken |
Tokens::createUserToken |
create_user_token |
CreateUserToken |
| Sign a partner user token | createPartnerUserToken |
Tokens::createPartnerUserToken |
create_partner_user_token |
CreatePartnerUserToken |
| Verify a webhook | verifyWebhook |
Webhook::verify |
verify_webhook |
VerifyWebhook |
| Partner API client | PartnerClient |
PartnerClient |
PartnerClient |
NewPartnerClient |
| Package | @nexafon/node (npm) |
nexafon/nexafon-php (Composer) |
nexafon (PyPI) |
github.com/Keyd-Solutions/nexafon/packages/server-go |
| Runtime | Node 20.19+ | PHP 8.1+ with ext-curl | Python 3.9+ | Go 1.22+ |
Tokens from every helper carry the same claims, and the same webhook fixtures verify in all four; Nexafon’s CI checks both against the real API.
Guides: Node, PHP, Python, Go. Another language? A user token is a plain HS256 JWT: user tokens describes it, and signatures the webhook check.
Configuration
Section titled “Configuration”| Variable | Read by | |
|---|---|---|
NEXAFON_SECRET_KEY |
createUserToken |
A workspace secret key (sk_live_…/sk_test_…) |
NEXAFON_PARTNER_SECRET_KEY |
partner tokens, PartnerClient |
A partner secret key (psk_live_…/psk_test_…) |
NEXAFON_API_URL |
PartnerClient |
The API origin, https://api.nexafone.so |
Each can also be passed explicitly. Keep secret keys in your server’s environment or secret store; never ship them to a browser or an app.