Skip to main content
When a visitor sends an entry into one of your published widgets (a vote, an RSVP, a form answer), Widgetic can call your server. You ask once, over MCP, with events/subscribe. From then on each entry is announced to the address you gave, with a signed POST. The call says which widget and table the entry went to, never what the visitor wrote: your code, or your assistant, reads the entry with the get_widget_data tool.
What is offered. MCP events follow the Events extension of the Model Context Protocol. Widgetic offers one event, submission.created, and one way to receive it, a webhook. The push mode of the extension (events/stream) is not offered, and events/poll does not return the nextPollMs of the extension.
Any workspace on a plan with API access can use MCP events: you do not have to be a partner. A partner account is also told about the entries of its customers’ widgets by the entry.created webhook.

What you need

  • A workspace on a plan that includes API access.
  • A credential that may read. Sign in with Widgetic and approve widgetic.read, or use an API key made with full access: see Authentication.
  • The composition_id of a published widget that keeps entries. list_widgets and get_widget return it, and in the REST API it is the id of the composition. A widget made to gather what visitors send (a poll, a rating, a sign-up) keeps entries.
  • An address that takes a POST, on the same terms as a partner webhook: https, on the standard port, with no user name or password in it, the name of a public website, and no redirect.

How it works

1

Subscribe

Call events/subscribe on https://mcp.widgetic.com with the widget, your address and a signing secret that you make.
2

Answer the check

Before it delivers anything, Widgetic sends your address a signed call with a challenge. Your address gives the same challenge back.
3

Receive the entries

Each entry sent to the widget is announced to your address, once. Check the signature, drop an event you already handled, and answer with a 2xx.
4

Read the entry

The call names the widget and the table, and the entry’s id when it has one. Read what was sent with get_widget_data, or with the entries routes of the REST API, such as GET /compositions/{id}/entries/{table}/items.
5

Refresh before it ends

A subscription lasts unless you ask for another time. Call events/subscribe again with the same details before refreshBefore to keep it.

Subscribe

Make a secret first: whsec_ and the base64 of 24 to 64 random bytes. Keep it where your receiver can read it.
Then subscribe. The MCP endpoint takes JSON-RPC over POST, and a request has to send both Content-Type: application/json and Accept: application/json, text/event-stream. The answer is a single JSON document.

Check the address

The first time you subscribe with an address and a secret, Widgetic sends the address a call before it delivers anything:
Check its signature like any other call, then answer with a 2xx and the same challenge, as JSON, within :
A success for the same address and secret is remembered for , so refreshing a subscription does not send the check again at once. When the check fails, events/subscribe answers with the error -32015 and says why in data.reason: see Errors.

Deliveries

Each entry is announced with a signed POST to your address. This is one as it arrives:
Widgetic sends the body as one line, without spaces, and the signature covers exactly those bytes. The signatures above are made with the example secret of Verify signatures. A call never holds anything a visitor wrote. What a visitor types is untrusted text, and an event can be handed to a model without a person reading it first, so the call carries only ids and names.

Answer and retries

Delivery is at least once: keep the eventIds you handled and drop a repeat. After failed deliveries in a row, Widgetic removes the subscription. A delivery fails when the first try and every retry failed. For one subscription, at most events a minute are sent: the rest are not sent, and stay in the log, where you can catch up with them. Before every delivery Widgetic checks again that the permission, the plan and the ownership of the widget still hold. If they do not, the subscription is removed and nothing is sent.

Which entries are announced

An event is raised for each entry that is stored in a widget somebody watches:
  • an entry that a visitor sends from the published widget, with POST /embed/compositions/{compositionId}/entries/{table};
  • a record that you add with the API, with POST /compositions/{id}/database/{table}.
It is raised once for each entry, however it was stored. A row that another system writes straight into a database raises no event, except for a partner: the rows its own system writes into its customers’ widgets are announced within about five minutes, when its entry.created webhook is on. Several assistants or services can watch the same widget. Each subscription has its own address, secret and lifetime.

Receive the calls

This Express receiver keeps the body as it arrived, checks it, answers the check of the address, drops an event it has already handled, and answers quickly. It uses the verifyWidgeticWebhook function of Verify signatures, which checks both kinds of call.

Catch up on what you missed

Before it announces an entry, Widgetic writes the ids and names of the event, never what a visitor wrote, to a log that it keeps for . Every delivery carries a cursor, the place of the event in that log. Save the last one you handled, and use it to get what came after it.
  • events/subscribe with a cursor. The events after it are sent to your address again, oldest first, with the eventId and the timestamp they had, right after the answer: at most at a time. The cursor of the answer is the place just before the first of them, so if the replay is lost on its way, saving it gets you the same events again. Subscribe again with the cursor you saved after each restart, and each time you refresh.
  • events/poll. It returns the events after a cursor in the answer, for a client that cannot be called, or that wants to check. It needs the name, the arguments and the delivery of a subscription you hold, cursor, and maxEvents (at most ). It answers events, each with its own cursor, the cursor to use next, hasMore and truncated.
A few things to know:
  • With no cursor, a first subscription starts now: it is not handed what happened before it.
  • truncated: true says that the cursor you sent is not one of Widgetic’s, is newer than the log, or is older than the oldest event it still holds: some events may be missing. Read the entries with get_widget_data to see where things stand.
  • The log holds the events of a widget while an unexpired subscription watches it. If yours lapses because you did not refresh it in time, nothing is kept for that time, and your next events/subscribe starts from now.
  • An event that is waiting for a retry when Widgetic restarts is not lost: it is in the log, and the cursor you saved gets it again.
  • events/poll does not recommend how often to poll (the nextPollMs of the extension), so choose an interval of your own.

Stop

Call events/unsubscribe with the name, the arguments and the delivery of the subscription (mode and url, without the secret). It answers with success whether or not the subscription existed, so a second call does no harm. A subscription you stop refreshing ends by itself at refreshBefore.

Limits

Errors

An event method answers a refusal with HTTP 200 and a JSON-RPC error, whose code is one of these. The endpoint answers the other problems with an HTTP status: 401 for no credential or one that is not valid, 403 when the plan has no API access or the key is limited, 406 when Accept does not list both application/json and text/event-stream, 413 for a body over 1 MiB, and 429 for too many requests. See Errors at the door.

Verify signatures

Check a call in TypeScript, Python, Go, Java, C#, Ruby or PHP.

AI agents (MCP)

Connect an assistant and build widgets from a conversation.

Event reference

The call of submission.created and the check of your address.