Webhook guide
Providers should request webhook signatures
Section titled “Providers should request webhook signatures”Verify that the webhooks received have actually originated from Underline. To do this, the requests are signed with HTTP Signatures (IETF specification).
According to the spec, the receiver of the request should use the keyId to look up the correct key for validating the signature. The key and keyId must be agreed in advance with Underline so that we can produce webhook requests with valid signatures.
When keys are rotated, providers should retain the previous key versions as well as the server logic to validate the corresponding signatures. Underline will use the latest key for new webhook events, but retries for older events may still use the older keys until those requests are completed or exhaust their retries. This system will allow for key rotation at any time including during full production load. Underline uses the Go language binding for HTTP Signatures created by @go-fed on GitHub.
The following language bindings are available:
Additionally, there are several Python implementations in the pypi.org repo and Javascript implementations in the npmjs.com repo.
NOTE: Only the “(request target)” and the Date header are included as inputs to the signature. Only those fields should be used when verifying the signature.
List of webhook events
Section titled “List of webhook events”The events below are the ones Underline sends to merchants. The seven subscription events have generated reference pages from the OpenAPI spec; the remaining one (which the spec does not yet describe) is documented inline further down this page.
| Event | Trigger | Details |
|---|---|---|
subscription.provision.service |
Sent when the provider needs to provision a service, it is sent to all services that the user subscribes to that belongs to the provider. | View |
subscription.unprovision.service |
Sent when the provider needs to unprovision a service. | View |
subscription.activated |
Sent when the subscription becomes active, this marks the start of billing. | View |
subscription.replace.service |
Sent when a service is being replaced with another service. Keep supporting it alongside the amend events (see Amending a subscription). | View |
subscription.amend.service |
Sent when an existing subscription is amended (base service or price change, or an option added, removed, or changed in quantity) and the merchant needs to apply the change. | View |
subscription.amend.activated |
Sent when an amendment is complete and billing has been updated to reflect it. | View |
subscription.terminated |
Sent when the subscription is terminated, this marks the end of billing. | View |
user.updated |
Sent when a user’s profile changes (name, email, or phone number). | View |
Payload shapes here reflect exactly what Underline sends on the wire. Deprecated fields are omitted from these documents.
Amending a subscription
Section titled “Amending a subscription”subscription.amend.service and subscription.amend.activated cover changes to a subscription that already exists. Amendments include:
- Changing the base service of the subscription, for example moving from 500 Mbps to 1 Gbps.
- Changing the price of the subscription.
- Adding an option, for example adding a static IP to an internet service.
- Removing an option.
- Changing the quantity of an option, for example increasing or decreasing the number of voice lines.
The flow is:
- Underline sends
subscription.amend.service. The payload holds the amendedsubscriptionandserviceplus theprevious_subscriptionandprevious_service; compare the two to see what changed. - Apply the change on your side.
- Once it is done, call the
providerSetSubscriptionServiceStatusmutation withactionTypeset toamendandisCompleteset totrue. See Update provisioning status. - When the amendment is complete and billing has been updated, Underline sends
subscription.amend.activated.
subscription.replace.service carries the same before-and-after information under different field names: new_subscription and old_subscription, new_service and old_service, plus new_provider_handoff and old_provider_handoff. If you handle both events in one place, map the fields rather than reading one payload as the other.
Keep handling subscription.replace.service alongside the amend events; do not assume a base service change always arrives as an amend.
user.updated
Section titled “user.updated”Emitted when a user’s profile is modified. Note this event is not subscription-scoped; it fires on the user record itself and is currently routed through the marketplace webhook channel while the platform consolidates its event surface.
Payload
{ "action": "user.updated", "user": { "id": "usr_...", "first_name": "Jane", "last_name": "Doe", "email": "jane@example.com", "phone_number": "+15555550123" }}| Field | Type | Notes |
|---|---|---|
action |
string | Constant user.updated. |
user.id |
string | Underline user identifier. |
user.first_name |
string | |
user.last_name |
string | |
user.email |
string | |
user.phone_number |
string (optional) | Omitted when the user has no phone on file. |