Cert Chief webhooks
Cert Chief sends a webhook when a domain gets a different certificate, a certificate is about to expire, an issuer revokes a certificate, the DNSSEC or DANE status of a domain changes, or a domain gets a new Server Test grade. Use them to open a ticket before a certificate expires, alert the team that owns a service, or keep a certificate inventory in another system current without polling the API.
Deliveries are signed, retried, and logged the same way in every Chief Tools product. Read Receive webhooks first for verification, responses, retries, and duplicates. This page covers what is specific to Cert Chief, most of all how its payloads are built.
Set up an endpoint
Open Notifications in Cert Chief, choose Webhooks, and add an endpoint. Then send it a test event from the endpoint's page. Deliveries come with the User-Agent CertChief-Webhooks/1.0.
Add an endpoint from code
Endpoints are managed through the GraphQL API with a token that has the certchief:webhooks:write scope. webhookEndpointCreate adds one:
Code
Code
Use ["*"] as events to receive every event, including types added later. Store the secret with your other secrets. You can read it again later through the endpoint's secret field, which also needs the write scope.
When status.success is false, endpoint is null and status.errors names the input field that is wrong, such as url or events.0. The same happens when your plan has no room for another endpoint.
Send a test event
webhookEndpointSendTest sends the endpoint a webhook_endpoint.test event, whether or not it subscribed to any event:
Code
The test event's data holds the endpoint it was sent to:
Code
Which events an endpoint gets
Events are about domains, and every team that watches a domain gets its events on its own endpoints. A team that muted a domain gets no events for it, the same as for its notifications.
How payloads are built
Other Chief Tools products send the resource an event is about as data.object. Cert Chief builds data with GraphQL instead. Every event type has its own payload type in the Cert Chief schema, and data is the result of a fragment on that type. The body reads like the data of a GraphQL response, and its fields have the same names and types as in the API.
For certificate.changed, the payload type is CertificateChangedWebhookEvent, with the domain, the certificate it serves now, and the certificate it served before. The fragment picks these fields from it:
Code
Read the fragment of an event
webhookEventTypes lists every event type with its payload type and the complete fragment its data is built with. It needs no scope:
Code
Code
Generate types for your receiver
The fragment and the schema together describe exactly what data holds. Save the document of each event you handle as a .graphql file, download the schema from https://cert.chief.app/api/graphql/schema, and point your GraphQL code generator at both. You get a type for each payload without writing it by hand.
Fields can be added
New fields can appear in a fragment, and with them in data. Ignore fields your receiver does not know. Enums such as status can get new values, so handle an unknown value without failing the whole event.
data shows the state at the moment the event happened. To get the current state of a domain or certificate, query it with the id from the payload, or open its permalink in Cert Chief.
Events
Each event type links to its payload type in the API reference, with a description of every field.
Certificates
| Type | Sent when |
|---|---|
certificate.changed | A domain serves a different certificate than before, such as after a renewal. valid tells whether the new certificate is valid. |
certificate.expiring | The certificate of a domain expires soon or expired. See Expiry reminders. |
certificate.installed | A domain that served no certificate serves one. |
certificate.removed | A domain no longer serves a certificate. |
certificate.revoked | The issuer revoked the certificate of a domain. |
certificate.unrevoked | A revoked certificate is no longer revoked. |
Domains
| Type | Sent when |
|---|---|
domain.dnssec_changed | The DNSSEC status of a domain changed. |
domain.dane_changed | Whether the certificate matches the TLSA records of a domain changed. |
valid and previousValid are true when the check passes and false when it fails. They are null when the check does not apply, for a domain without DNSSEC or without TLSA records. DANE relies on DNSSEC, so domain.dane_changed also carries dnssecValid.
Server Test
| Type | Sent when |
|---|---|
server_test.grade_changed | A new Server Test of a domain finished with a different grade than the one before. |
report is the new test and previousReport the one before it. The permalink of a report opens the full test results. A test that could not grade the server, with the grade - or E, sends no event, and neither does the next test after one.
Expiry reminders
Cert Chief checks expiry dates once a day. It sends certificate.expiring four, three, two, and one day before a certificate expires, on the day it expires, and one, two, three, four, seven, ten, and fourteen days after.
daysLeft counts down to 0 on the day the certificate expires and is negative after it, and expired is true once it has. Renewing the certificate stops the reminders, and the domain sends certificate.changed instead.
Examples
A certificate was renewed
Code
A certificate expires in four days
Code
Manage endpoints and deliveries
The team query has the team's webhook endpoints, events, and deliveries, with the certchief:webhooks:read scope. This request lists each endpoint with the attempts of the last 24 hours and its latest failed deliveries:
Code
webhookDeliveryreturns one delivery with every attempt, including the request headers and the response your receiver gave.webhookEventslists events with the exactpayloadevery delivery sent.webhookDeliveryResendsends a delivery again, andwebhookEventResendsends an event to another of the team's endpoints.
payload, requestHeaders, and the response headers are JSON fields. They arrive as JSON-encoded strings, so parse them before you use them.
Common integrations
- Expiry tickets. Subscribe to
certificate.expiringand open a ticket for the team that ownsdata.domain.display. Close it when the same domain sendscertificate.changedwithvalidset totrue. - Security alerts. Subscribe to
certificate.revoked,certificate.removed, anddomain.dane_changed, and page someone when they arrive. - Certificate inventory. Subscribe to
certificate.changed,certificate.installed, andcertificate.removed, and store the certificate fromdataby domain. Load the current state once with the domains and certificates ofteam, and again to catch up after your receiver was down for longer than the retries last.
Events are kept for 30 days. For anything older, query the current state from the API.