Skip to content
    Guide

    Webhooks: send MaintainHQ events to your own systems

    Last updated

    A webhook is a message MaintainHQ sends to your own system the moment something happens. Instead of your software asking MaintainHQ “has anything changed?” over and over, MaintainHQ tells it straight away: a backup finished, an update failed, a site went down.

    You might use webhooks to log events in your own database, update a client record in your CRM, or start an automation in another tool. This guide covers setting up an endpoint, the events you can choose, what each message looks like, how to check it really came from MaintainHQ, and what happens when your system does not answer.

    Webhooks or alerts?

    MaintainHQ has two different things that can be called a webhook:

    • Webhooks (this guide), under Settings: structured event data for software to read, signed so your system can trust it.
    • The webhook alert channel, under Alert settings: formatted alerts meant for people, alongside Slack, Teams, email and the rest.

    If you want a person to be told something, use alerts. If you want software to act on something, use webhooks.

    Only the account owner or a team Admin can manage webhooks.

    Adding an endpoint

    An endpoint is the web address on your system that receives the events.

    1. Open Webhooks under Settings in the left-hand menu and press Add endpoint.
    2. Enter the Endpoint URL. It must be a public address starting with https://.
    3. Optionally add a Description, such as “Our client CRM”, so you know what it is for later.
    4. Under Events, tick the events you want. Select all ticks every event.
    5. Under Sites, leave “Every site, including ones added later” switched on, or switch it off and tick specific sites.
    6. Press Add endpoint.
    7. MaintainHQ shows the signing secret (it starts with whsec_). Copy it now and keep it on your receiving server. It will not be shown again.

    An account can have up to 20 endpoints.

    The events

    Events you can subscribe to
    EventWhen it is sent
    site.connectedA WordPress site connected (or reconnected) to MaintainHQ.
    site.disconnectedA site stopped answering the MaintainHQ connector for over 3 hours.
    update.completedA plugin, theme or WordPress core update finished.
    update.failedAn update did not finish, including one that was interrupted.
    update.rolled_backAn update was rolled back to the previous version.
    backup.completedA backup finished.
    backup.failedA backup failed.
    incident.openedAn incident (for example the site going down) was opened for a site.
    incident.resolvedAn incident was resolved.
    vulnerability.foundA known vulnerability was found on a site.
    fix_plan.approvedA Gus fix plan was approved.
    deploy.completedA Git deploy finished successfully.
    domain.expiringA domain is close to its expiry date.
    ssl.expiringA site’s SSL certificate is close to expiry.

    There is also a test event, webhook.test, sent only when you press Send test event. You cannot subscribe to it.

    What each message looks like

    Each event is sent as an HTTP POST with a JSON body. JSON is a simple text format most programming languages read easily. The body always has these fields:

    Fields in every event
    FieldWhat it holds
    idA unique ID for the event. It stays the same on every retry and resend.
    typeThe event name, such as backup.completed.
    created_atWhen the event happened.
    teamThe account’s ID and name.
    siteThe site’s ID, name and address. Empty (null) for account-level events.
    dataDetails for that event, such as a backup’s type and size.

    The request also carries headers, including X-MaintainHQ-Event (the event type), X-MaintainHQ-Event-Id (the same as id), X-MaintainHQ-Delivery (unique to each attempt) and X-MaintainHQ-Signature.

    Checking the signature

    Anyone who knows your endpoint address could send it fake data. The signature lets your system prove a message really came from MaintainHQ.

    The X-MaintainHQ-Signature header looks like “t=1763121600,v1=5f2c…”. The t part is a timestamp. The v1 part is an HMAC-SHA256 code: a fingerprint made by combining the timestamp, a full stop and the raw body with your signing secret.

    1. Read the raw body exactly as it arrived, before any JSON parsing. Re-encoded JSON will not match.
    2. Split the header on the comma into its t and v1 parts.
    3. Work out the HMAC-SHA256 of the timestamp, a full stop and the raw body, using your signing secret.
    4. Compare your result with v1 using a constant-time comparison, which most languages provide.
    5. Reject the message if the timestamp is more than 5 minutes away from your server’s clock. This stops someone replaying an old message.

    Your developer will find ready-made code for this in most languages. The header name and an explanation are also shown at the top of the Webhooks page.

    Answering, retries and switching off

    Your endpoint should answer with any 2xx status code (such as 200 OK) within 10 seconds. Do slow work after you have answered.

    Anything else, or no answer, counts as a failure. MaintainHQ tries again after 1, 2, 4, 8, 16, 32 and 64 minutes, so 8 attempts in all.

    Testing, the delivery log and other settings

    Each endpoint has its own card with an on/off switch and these buttons:

    • Send test event: sends webhook.test straight away and tells you the response status and how long your endpoint took, or why it failed.
    • Deliveries: shows the delivery log, with the event, status, response, time taken and when it was sent. Retrying deliveries show when the next attempt is due. Click a delivery to see the exact payload sent and the response. Use the resend button to send one again.
    • Edit: change the URL, description, events or sites.
    • Replace secret: creates a new signing secret. The old one stops working straight away, so update your server immediately.
    • Delete (bin icon): stops events going to that URL and deletes its delivery log.

    Deliveries are kept for 30 days.

    Frequently asked questions

    Can I use a plain http:// address?
    No. Endpoints must be public https:// addresses, so event data is encrypted on its way to you.
    Why did my endpoint switch itself off?
    It failed 15 deliveries in a row. Fix the problem, switch it back on, then resend missed events from the delivery log.
    Can I receive the same event twice?
    Yes, through retries and resends. Use the event id to ignore events you have already handled.
    I lost the signing secret. What now?
    Press Replace secret on the endpoint, copy the new secret and update your server. The old secret stops working straight away.

    Let MaintainHQ run the routine

    Updates with automatic rollback, backups, uptime, security checks and client reports, with Gus to fix what breaks.

    Start free trial

    From £29 a month for up to 2 sites. Every plan starts with a 14-day trial.