Docs / For your masjid

Webhooks

A webhook tells your server that something changed on your masjid, so you do not have to poll. Masjidbox posts a small event to a URL you register; your server then reads the changed resource with its key.

Register an endpoint

Endpoints belong to your organization, not to a key: revoking the key that registered one does not silence it. Register one in your dashboard under API → Webhooks, or with a secret key holding Masjid profile: read:

bash
curl -X POST https://hub.masjidbox.com/v1/masjid/webhook-endpoints \
  -H "Authorization: Bearer mbx_sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.org/masjidbox/webhooks", "events": ["event.created", "event.updated"]}'
  • The URL must be https, on a public host name, with no user or password in it.
  • Five endpoints per organization.
  • The answer carries the endpoint's signing secret, whsec_…, once. Store it now: it is never shown again. If you lose it, rotate it (below).
  • Subscribing to an event needs the read right of its product on the key, in the tables below (else 403).

Events

Every event of a product needs that product's read right on the key. data.id is the prefix of the resource's id, or null when the event is about the whole masjid or a singleton (read the resource itself then).

Masjid profile

EventWhendata.id
masjid.updatedThe organization changednull
profile.updatedThe public profile changed (contact, capacity, facilities)null

Prayer times

EventWhendata.id
prayer_times.updatedThe prayer times changed (calculation method, athan or iqamah rules, timetable, special times)null
jumuah_times.updatedThe jumu'ah services changednull

Content

EventWhendata.id
event.created, event.updated, event.deletedAn eventevt_…
announcement.created, announcement.updated, announcement.deletedAn announcementann_…
media.created, media.updated, media.deletedA media (an upload confirmed is a media.created)med_…
news.created, news.updated, news.deletedA news itemnws_…
album.created, album.updated, album.deletedAn albumalb_…
collection.created, collection.updated, collection.deletedA collectioncol_…
poll.created, poll.updated, poll.deletedA poll (a vote is not a change of the poll)pol_…
quiz.created, quiz.updated, quiz.deletedA quiz (a play is not a change of the quiz)qiz_…
question.updated, question.deletedAn ask-the-imam question answered, archived or deletedqst_…
live.created, live.updated, live.deletedA liveliv_…

A question is asked in the app, so there is no question.created. A question event carries its id only: Content: read subscribes to it, and reading the question itself takes a secret key. Activating a live deactivates your other lives without an event for each: read GET /v1/masjid/lives after a live.updated.

Notifications

EventWhendata.id
notification.created, notification.updated, notification.deletedA Masjidbox One notificationntf_…
app_notification.created, app_notification.updated, app_notification.deletedA scheduled app pushapn_…
app_recurring_notification.created, app_recurring_notification.updated, app_recurring_notification.deletedA recurring app pusharn_…
app_one_time_notification.created, app_one_time_notification.updated, app_one_time_notification.deletedA one-time app pushaon_…

Donation campaigns

EventWhendata.id
donation_account.updatedThe donation accountnull
donation_campaign.created, donation_campaign.updated, donation_campaign.deletedA donation campaigncmp_…

No event carries donor data: donations, recurring donations and receipts send none. Read them with their cursor (updatedSince) instead.

Website and app

EventWhendata.id
website.updatedThe website (closed, maintenance)null
widget.created, widget.updated, widget.deletedA website widgetwdg_…
app_widget.updatedThe app's widgetnull
app_popup.created, app_popup.updated, app_popup.deletedAn app popupapo_…
app_page.created, app_page.updated, app_page.deletedAn app page (its popup included)the page's id

Screens

EventWhendata.id
screen.updated, screen.deletedA screen (a player, an android, a tizen)scr_…
screen_settings.updatedThe screen settingsnull
playlist.created, playlist.updated, playlist.deletedA playlist (a duplicate is a playlist.created)pll_…
playlist_schedule.created, playlist_schedule.updated, playlist_schedule.deletedA playlist schedulepsc_…

A screen is paired on the screen itself, so there is no screen.created. Statistics send no event.

Events are sent whether the change was made in the dashboard or through the API.

The payload

An event names what changed, never its content. Read the resource with your key to get its current state:

json
{
  "id": "whe_9f8e7d6c5b4a39281706f5e4d3c2b1a0",
  "type": "event.updated",
  "createdAt": "2026-11-17T09:00:00.000Z",
  "data": { "object": "event", "id": "evt_…" }
}
  • data.id is the resource's id, under the prefix of the tables above. It is null for the events about the whole masjid or a singleton (prayer_times.updated, masjid.updated, website.updated…): read that resource then.
  • After a *.deleted event, the resource answers 404.
  • prayer_times.updated waits 30 seconds before it is sent, so a burst of changes is one event.

Verify the signature

Every request carries a Masjidbox-Signature header:

http
Masjidbox-Signature: t=1731830400,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd

t is when Masjidbox signed the request, in Unix seconds. Each v1 is the hex HMAC-SHA256 of <t>.<raw body>, keyed with the endpoint's secret. There are two v1 for 24 hours after a rotation, one per secret: accept the request if one matches.

Verify the raw body, byte for byte, before you parse it. Refuse a request whose t is more than five minutes old, so a captured request cannot be replayed. In Node.js:

js
import { createHmac, timingSafeEqual } from 'node:crypto';

const TOLERANCE_SECONDS = 300;

export const verifyMasjidboxSignature = (rawBody, header, secret) => {
  const parts = header.split(',').map((part) => part.split('='));
  const t = Number(parts.find(([key]) => key === 't')?.[1]);
  if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > TOLERANCE_SECONDS) return false;

  const expected = createHmac('sha256', secret).update(`${t}.${rawBody}`, 'utf8').digest();
  return parts
    .filter(([key]) => key === 'v1')
    .some(([, signature]) => {
      const given = Buffer.from(signature, 'hex');
      return given.length === expected.length && timingSafeEqual(given, expected);
    });
};

With Express, read the body as text for that route: express.raw({ type: 'application/json' }), then verifyMasjidboxSignature(req.body.toString('utf8'), req.get('Masjidbox-Signature'), secret). The scheme is Stripe's: a Stripe-style verifier works once pointed at this header.

Answer, retries and disabling

  • Answer with any 2xx within 10 seconds. Do the work after answering: a slow answer is a failure.
  • A redirect (3xx) is a failure: Masjidbox does not follow it.
  • A failed delivery is retried after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and 24 hours, then marked failed.
  • An event can arrive more than once, and events can arrive out of order. Use id to drop one you have already handled, and read the resource for its current state rather than trusting the order.
  • An endpoint that fails every delivery for 3 days is disabled, and your organization's owner gets an email. Fix the URL, then turn it back on in the dashboard or with PATCH /v1/masjid/webhook-endpoints/{id} and {"enabled": true}. The events of the meantime are not resent.

Deliveries and secrets

  • GET /v1/masjid/webhook-endpoints/{id}/deliveries lists the last 30 days of deliveries: status, attempts, the answer's status code.
  • POST /v1/masjid/webhook-endpoints/{id}/deliveries/{deliveryId}/resend sends one again.
  • POST /v1/masjid/webhook-endpoints/{id}/rotate-secret answers a new secret, once. The previous one keeps signing for 24 hours, so you can switch without missing an event.

Every operation is in the API reference.