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.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_idof a published widget that keeps entries.list_widgetsandget_widgetreturn it, and in the REST API it is theidof 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.
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:2xx and the same challenge, as JSON, within :
events/subscribe answers with the error -32015 and says why in data.reason: see Errors.
Deliveries
Each entry is announced with a signedPOST to your address. This is one as it arrives:
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}.
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 theverifyWidgeticWebhook 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 acursor, the place of the event in that log. Save the last one you handled, and use it to get what came after it.
events/subscribewith acursor. The events after it are sent to your address again, oldest first, with theeventIdand thetimestampthey had, right after the answer: at most at a time. Thecursorof 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 thename, theargumentsand thedeliveryof a subscription you hold,cursor, andmaxEvents(at most ). It answersevents, each with its owncursor, thecursorto use next,hasMoreandtruncated.
- With no
cursor, a first subscription starts now: it is not handed what happened before it. truncated: truesays 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 withget_widget_datato 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/subscribestarts 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/polldoes not recommend how often to poll (thenextPollMsof the extension), so choose an interval of your own.
Stop
Callevents/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 HTTP200 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.