Developer & API
This page is for developers extending a site. Everything here is the plugin’s public contract and changes only with a major version. Everything else in the plugin’s code is internal and may change in any release.
Push a row from your own code
gather_grove_notion_record( array $payload ): string sends one submission through the same steps as a live form: routing, shared fields, merging, new columns, retries and the activity log. It returns created, updated, skipped, failed or disabled. disabled means no database is configured and nothing was sent, so keep your own copy.
| Key | What it is |
|---|---|
formId | A stable slug. Used for routing, per-form overrides and the Form ID column. |
formName | The readable name. Becomes Form Name, the row title and the column prefix. |
fields | A list of [ 'id', 'title', 'type', 'multiple', 'value' ]. title is the column label. |
sourceUrl | Optional. The page it came from. |
submittedAt | Optional. A Unix timestamp or a date string; anything unreadable, before 2000, or more than a day ahead becomes “now”. |
submissionId | Optional. Your own record ID, shown in the activity log. |
source | Optional. Shown in the activity log’s source column; defaults to api. |
Field type takes the same tokens as Elementor: email, tel, url, number, date, select, checkbox, textarea, text and so on. Unknown types become text. select with 'multiple' => true becomes a multi-select. The type table is on How your data lands in Notion.
Fire-and-forget equivalent, with no return value: do_action( 'gather_grove/notion_sync/submission', $payload );
Upsert one row by a named column
gather_grove_notion_upsert_row( array $payload ): string, or do_action( 'gather_grove/notion_sync/upsert_row', $payload ), keeps one row current, for state such as a member’s stage rather than an event that happened.
matchOn(required): the column that identifies the row, for exampleEmail.row(required): column name to value. An array value becomes a multi-select.sourceandformId: routing. A Database override onformId(which defaults tosource) wins, then the source’s Sources-tab database, then the default.title: the row’s title, used only when the row is created.formName: the label that fillsForm NameandForms Submittedand names the source under Discovered forms, for example Gather Grove Pulse. Defaults toformId. Keep it the same on every call; the title is where a person’s name belongs.
Unlike a record, an upsert always matches on matchOn whatever the site’s merge setting, writes every column under the exact name you give (never prefixed), and adds nothing to the page body. A missing matchOn or an empty row returns skipped. Gather Grove Pulse uses this for its member rows.
Read sync status
These read-only helpers in GatherGroveNotionSyncStatusSyncStatus never write and never throw. They do no capability checks; check the user’s permissions before calling them.
SyncStatus::for_form( string $form_id ): arrayreturnsform_id,last_sync(UTC, last successful write, or null),last_error, andqueue_depthanddead. Those last two count retries for the whole site, not only this form.SyncStatus::find_synced_entry( int $wp_entry_id ): ?stringreturns the Notion page URL a submission was written to, or null. It reads the activity log, so a submission older than the latest 1,000 attempts returns null even if its row exists.
Force a resync
GatherGroveNotionSyncSyncTrigger::run( string $form_id, ?int $entry_id = null ): array sends an Elementor form’s submissions that haven’t been sent yet, skipping those already sent. Pass an entry ID to force that one submission to be sent again. It returns counts (processed, created, updated, skipped, failed, synced), up to 20 errors, and duration_ms. Errors come back in the array, never as exceptions. Gather Grove Companion’s Notion abilities are built on these helpers; see the Companion developer page.
The incoming webhook
POST /wp-json/gather-grove/notion-sync/v1/ingest with the header X-GG-Webhook-Secret. The secret is generated on the Sources tab, or set with the GATHER_GROVE_NOTION_SYNC_WEBHOOK_SECRET constant in wp-config.php, which then takes over from the Sources tab.
The JSON body takes formId (default webhook), formName, and either:
fields: a list of objects withtitle(orname),value, and optionallytype,idandmultiple; ordata: an object of label to value, all written as text.
The submission time is always the moment the request arrives. Responses:
| Status | Meaning |
|---|---|
200 | {"result": "created"}, updated or skipped |
400 | The body isn’t a JSON object, or has no usable fields |
403 | Missing or wrong secret, or no secret is set |
502 | {"result": "failed"}: Notion refused the write, or it is queued for retry |
503 | {"result": "disabled"}: no database is configured |
Filters, actions and constants
gather_grove_notion_sync_skip_demo(filter, defaulttrue): whether Gather Grove Booking’s Demo Mode showroom activity is held back. Returnfalseto sync it.GG_NOTION_OAUTH_BROKER(constant): the address of your own connection service, for self-hosters running one in place of gathergrove.io.
Mirrored Notion pages
The one place the plugin reads from Notion. Another plugin can register a Notion page with GatherGroveNotionSyncRepositoryPages::register_for_sync(). The page is then copied into a local table every 15 minutes and served with Pages::content_for() as ready-to-print HTML, with no network call at render time. A page deleted or unshared in Notion is marked orphaned and its last content is kept. gather_grove/notion_sync/page_updated fires only when a page’s content actually changed. Check Pages::is_available() before offering the feature. The full contract, including statuses, is in the plugin’s docs/PUBLIC_API.md.
Applies to Gather Grove Sync for Notion v0.52.3. Last synced October 15, 2026.