Add band number activate/deactivate for service-activation orders#6
Merged
Add band number activate/deactivate for service-activation orders#6
band number activate/deactivate for service-activation orders#6Conversation
Adds verb-style commands to flip per-number voice/messaging activation
flags via the Universal Platform's serviceActivation endpoint:
band number activate <num...> --voice-inbound [--wait]
band number deactivate <num...> --voice-inbound
Supports voice (inbound, outbound-national, outbound-international) and
messaging service flags, plus --dry-run (calls /serviceActivationChecker
to return the eligibility matrix without creating an order), --wait
(polls /serviceActivation/{orderId} until status leaves RECEIVED /
PROCESSING), --timeout, and --customer-order-id.
Underlying API:
POST /api/v2/accounts/{accountId}/serviceActivation
POST /api/v2/accounts/{accountId}/serviceActivationChecker
GET /api/v2/accounts/{accountId}/serviceActivation/{orderId}
Verb pair instead of a single `band number set` because:
- The API resource is genuinely an async order with orderId/orderStatus,
matching the `--wait` pattern that already exists for `number order`,
`call create`, and `transcription create`.
- Verbs are unambiguous in shell history and CI logs vs. flag-driven
mode-switching, which is friendlier for agents.
- Slots cleanly into the existing voice-provisioning workflow diagram
between `vcp assign` and `call create`.
Validated end-to-end against the live API: dry-run returned the IN_SERVICE
matrix; DEACTIVATE flipped inboundActivated true→false (orderStatus
COMPLETE); ACTIVATE flipped it back; outbound flags untouched throughout.
Tests cover the body builder (voice-only, all-services, voice+messaging,
deactivate action, missing-services validation, customer-order-id passthrough)
and the checker body shape.
README gets new rows in the number commands table and a usage-example
line. AGENTS.md gets the activate step added to both Universal Platform
workflow diagrams, a walkthrough step 7, and a timeout-recovery row.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Add Context7 ownership data
ckoegel
approved these changes
Apr 30, 2026
joshraub-bw
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds verb-style commands to flip per-number voice/messaging activation flags via the Universal Platform's
serviceActivationendpoint:This closes a gap in the existing voice-provisioning workflow. After
vcp assign, an inbound call to a fresh number didn't actually route to your app —inboundActivateddefaults tofalseon new numbers and the only way to flip it was the dashboard. With this PR theauth → app → vcp → number → vcp assign → callchain extends to… → number activate → call, fully programmable.Why a verb pair, not
band number setThe underlying API resource is genuinely an async order (with
orderId,orderStatus, polling), not a property mutation:--waitpattern (number order,call create,transcription create).API surface
All Universal Platform, all documented at https://dev.bandwidth.com/docs/universal-platform/service-activation:
POST /api/v2/accounts/{id}/serviceActivationPOST /api/v2/accounts/{id}/serviceActivationChecker--dry-runeligibility matrixGET /api/v2/accounts/{id}/serviceActivation/{orderId}--waitpollingService flags map directly to the documented values:
--voice-inbound→services.voice = ["INBOUND"]--voice-outbound-national→["OUTBOUND_NATIONAL"]--voice-outbound-international→["OUTBOUND_INTERNATIONAL"]--messaging→services.messaging = ["ALL"]Plus
--customer-order-idfor traceability and--timeout(default 60s) for--wait.Test plan
BuildServiceActivationBody(voice-only, all-services, voice+messaging, deactivate action, missing-services validation, customerOrderId passthrough) andBuildCheckerBody. 7 new tests, no existing tests touched.--dry-run→ checker returned the IN_SERVICE matrixdeactivate ... --voice-inbound --wait→ order polled RECEIVED → COMPLETE;inboundActivatedflippedtrue→false; outbound flags untouchedactivate ... --voice-inbound --wait→ flipped back totruego build ./...cleango test ./cmd/number/...all greenDocs
README.md: new rows in theband numbercommand table; usage-example block updatedAGENTS.md:Things to scrutinize
activate.go+deactivate.go+service_activation.goshared) vs one combined file. The 90% shared logic argued for splitting; the codebase's one-file-per-command norm could argue for combining. Happy to consolidate if preferred.--if-not-exists. AGENTS.md says creates should support it; activation orders are technically creates. I left it out for v1 because "is service X already active" requires an extraserviceActivationCheckercall and meaningful state comparison. Reasonable v1.1 follow-up.auth statuscapability check. Following the fast-fail-from-API pattern thatvcp updateand other write commands use.