Martha, sit

Guides ·

"Connect other systems: pass changes on to a LINE group"

When the calendar or a schedule changes, Martha, sit can send what changed to a URL. Receive it with a tool such as n8n or Make, and you can pass it on to a LINE group or anywhere else.

This guide uses n8n: setting up a URL to receive notifications, checking that they really come from Martha, sit, and posting them to a LINE group. Only admins can set this up.

1. Create a webhook in n8n

Create a workflow and add a Webhook node:

  • HTTP Method: POST
  • Path: something easy to recognize, such as martha
  • Respond: Immediately

Switch to the Production URL tab at the top and copy the URL.

n8n’s Webhook node with the Production URL tab selected

The Test URL only works while the editor is listening for a test event. For everyday use, take the Production URL and publish (activate) the workflow.

2. Add the URL in Martha, sit

Go to Settings → Church info. Connect other systems is at the bottom.

Connect other systems in Church info

Paste the URL, choose which changes to send, and tap Save.

  • Calendar changes: events added, edited, or deleted in Martha, sit. Edits made directly in Google Calendar aren’t sent.
  • Schedule changes: changes made within a few minutes go out together, about every 5 minutes.
  • Weekly schedule: tap it to turn it on and pick the day, the time, and which services. At that time it sends the next 7 days’ schedules.
The URL filled in and both switches on

The URL has to start with https://.

3. Check that it came from Martha, sit

Anyone who knows the URL can send things to it, so every notification is signed. Once you’ve saved, the page shows a signing secret. Tap Show to see it and Copy to copy it.

The signing secret, with Show and Copy

Here’s how the signature is made: join the x-martha-timestamp header, a period, and the raw body; compute an HMAC-SHA256 of that with the secret; write it in hex and put sha256= in front. That’s the value of the x-martha-signature header.

In n8n, two nodes do the check.

Crypto node

Add a Crypto node after the Webhook. The first time, create a Crypto credential and paste the secret into Hmac Secret.

  • Action: Hmac

  • Type: SHA256

  • Value:

    {{ $json.headers['x-martha-timestamp'] + '.' + JSON.stringify($json.body) }}
    
  • Property Name: expected

  • Encoding: HEX

The Crypto node’s settings

The body Martha, sit sends is itself the output of JSON.stringify, so running JSON.stringify on what n8n parsed gives back exactly the same string.

If node

Then add an If node where both conditions must hold (AND):

  1. {{ $json.expected }} is equal to {{ $json.headers['x-martha-signature'].replace('sha256=', '') }}
  2. {{ Math.abs($now.toSeconds() - Number($json.headers['x-martha-timestamp'])) }} is less than 300

The If node’s two conditions

The second condition rejects anything older than 5 minutes, so a notification someone recorded can’t be replayed later. Connect everything after this to the true branch.

If you’re writing your own receiver

In Node.js, compute the signature over the raw body, not one you’ve parsed and turned back into a string:

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

function fromMartha(headers, rawBody, secret) {
  const timestamp = headers['x-martha-timestamp'];
  const signature = headers['x-martha-signature'] ?? '';
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const expected = 'sha256=' + createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');
  const a = Buffer.from(signature);
  const b = Buffer.from(expected);
  return a.length === b.length && timingSafeEqual(a, b);
}

4. Send a test

Back in Martha, sit, tap Send test. It sends a ping, and the line below shows when it was last sent and how it went.

A test sent successfully

The result is one of these:

  • Succeeded: the receiver answered with a 2xx status.
  • Responded 404 (or another number): the URL is wrong, or the workflow isn’t published.
  • Timed out: no answer within 5 seconds.
  • Couldn’t connect: the URL can’t be reached.

Each notification is sent once and never retried. A redirect counts as a failure.

In n8n, open Executions and look at the run that just came in. If Webhook, Crypto, and If all ran and If took the true branch, the signature checks out.

n8n’s execution, with the signature check passed

With the Webhook node set to Immediately, n8n answers as soon as anything arrives, so Succeeded in Martha, sit doesn’t mean the signature matched. To see that, check the execution in n8n.

5. Turn it into a message for LINE

After If’s true branch, add a Code node that turns the notification into a line of text. A ping has nothing to pass on, so it’s skipped:

const { headers, body } = $input.first().json;
const event = headers['x-martha-event'];
if (event === 'ping') return [];

let text;
if (event === 'roster.changed') {
  const lines = body.changes.map((c) => {
    const duties = c.duties.map((d) => {
      const names = [...d.added.map((n) => '+' + n), ...d.removed.map((n) => '-' + n)];
      return `${d.duty} ${names.join(' ')}`;
    });
    return `${c.date} ${c.serviceName}: ${duties.join(', ')} (${c.actorName})`;
  });
  text = `Roster changes\n${lines.join('\n')}`;
} else {
  const verb = { created: 'added', updated: 'changed', deleted: 'deleted' }[body.action];
  const when = body.allDay ? body.start : body.start.slice(0, 16).replace('T', ' ');
  text = `Event ${verb}: ${body.title}\n${when}`;
}
return [{ json: { text } }];

The Code node turning a schedule change into text

Posting to a LINE group goes through a LINE Official Account and the Messaging API (LINE Notify has shut down). In LINE Developers, create a Messaging API channel, get its channel access token, add the official account to your group, and find the group’s ID.

Finally, add an HTTP Request node:

  • Method: POST

  • URL: https://api.line.me/v2/bot/message/push

  • Header: Authorization set to Bearer <channel access token>

  • Body (JSON):

    {{ { to: '<group ID>', messages: [{ type: 'text', text: $json.text }] } }}
    

6. Replace the secret or disconnect

If the secret has leaked, or the person who had it has moved on, tap Replace secret. The old one stops working right away, so paste the new one into the Crypto credential in n8n, or every notification after that will fail the check.

Replacing the secret asks first

When you no longer need it, tap Disconnect. The URL and secret are deleted, and you’ll have to set it up again to use it.

What a notification contains

Every notification is a POST with a JSON body and these headers:

  • x-martha-event: ping, calendar.created, calendar.updated, calendar.deleted, roster.changed, or roster.weekly
  • x-martha-delivery: an ID for this notification (a UUID)
  • x-martha-timestamp: when it was sent, in Unix seconds
  • x-martha-signature: sha256= and the signature

The body always has source (always martha), churchId, churchName, and timeZone. Everything except a ping also has action: created, updated, deleted, changed, or weekly.

Calendar

{
  "action": "created",
  "source": "martha",
  "churchId": "demo-church",
  "churchName": "Grace Community Church",
  "timeZone": "Asia/Taipei",
  "id": "evt_1",
  "title": "Christmas choir practice",
  "allDay": false,
  "start": "2026-12-19T19:30:00+08:00",
  "end": "2026-12-19T21:00:00+08:00",
  "location": "Fellowship Hall",
  "description": "",
  "link": null,
  "actorUid": "u1",
  "actorName": "Grace Lin"
}
  • For a timed event, start and end are in the church’s time zone, with the offset.
  • For an all-day event they’re YYYY-MM-DD, and end is the last day, inclusive.
  • A deleted event is sent as it was before it was deleted.

Schedules

{
  "action": "changed",
  "source": "martha",
  "churchId": "demo-church",
  "churchName": "Grace Community Church",
  "timeZone": "Asia/Taipei",
  "count": 1,
  "imported": false,
  "more": 0,
  "changes": [
    {
      "date": "2026-12-20",
      "serviceId": "sunday",
      "serviceName": "Sunday Service",
      "eventId": null,
      "title": null,
      "duties": [{ "duty": "Piano", "added": ["Isaac Wang"], "removed": ["Grace Lin"] }],
      "actorUid": "u1",
      "actorName": "Grace Lin",
      "via": "swap"
    }
  ]
}
  • changes runs oldest first, up to 200 in one notification. more is how many were left out (0 if none), and count is the full number.
  • For an event’s schedule, serviceId is null, and eventId and title are that event’s.
  • via says how the change was made, such as app (edited directly), swap, claim, or import.

Weekly schedule

{
  "action": "weekly",
  "source": "martha",
  "churchId": "demo-church",
  "churchName": "Grace Community Church",
  "timeZone": "Asia/Taipei",
  "from": "2026-12-14",
  "to": "2026-12-20",
  "services": [
    {
      "date": "2026-12-16",
      "serviceId": "prayer",
      "serviceName": "Prayer Meeting",
      "noService": true,
      "noServiceReason": "Joint prayer",
      "events": [],
      "duties": [{ "duty": "Piano", "people": [] }]
    },
    {
      "date": "2026-12-20",
      "serviceId": "sunday",
      "serviceName": "Sunday Service",
      "noService": false,
      "events": ["Communion"],
      "duties": [
        { "duty": "Host", "people": [{ "name": "Grace Lin", "uid": "u1" }] },
        { "duty": "Piano", "people": [] },
        {
          "duty": "Usher",
          "people": [{ "name": "Isaac Wang", "uid": null }, { "name": "Elaine Chen", "uid": "u3" }],
          "changed": true
        }
      ]
    }
  ],
  "calendar": [
    {
      "id": "evt_1",
      "title": "Christmas choir practice",
      "allDay": false,
      "start": "2026-12-19T19:30:00+08:00",
      "end": "2026-12-19T21:00:00+08:00",
      "location": "Fellowship Hall",
      "description": "",
      "link": null
    }
  ]
}
  • It goes once, on the day and at the time you set, in the church’s time zone. from is the day it’s sent, and to is 6 days later.
  • services is in date order, one entry for each day a ticked service meets. If a service isn’t meeting that day, noService is true, with noServiceReason when a reason was written.
  • events are that day’s occasions.
  • An empty people means TBD. uid is the person’s Martha, sit account; it’s null for team members without an account, small groups, and names typed in.
  • changed: true means someone in that role was replaced or taken off since the month’s schedule was last shared with Share as image. Nothing is marked if that month hasn’t been shared yet.
  • undecided: true means whoever arranges it chose Leave empty: nobody on purpose (people is empty).
  • calendar lists the calendar’s events in those 7 days, with the same fields as calendar changes, minus actorUid and actorName.

Questions

The signature never matches

  • Was the secret replaced? Paste the new one into n8n.
  • In your own code, did you parse the body and turn it back into a string? Use the raw body.
  • Is the receiving server’s clock right? More than 5 minutes off and the time check rejects it.

n8n doesn’t receive anything

  • Are you using the Production URL, and is the workflow published?
  • Is the matching switch on? Events edited directly in Google Calendar aren’t sent.
  • Schedule changes take a few minutes to go out.

Times are off by a few hours

start and end already carry the offset (such as +08:00) and are in the church’s time zone. If you convert them with new Date() in n8n, they end up in the n8n server’s time zone. If you only need the date and time, take them straight from the string, as the Code node above does. The church’s time zone is in timeZone.