Page Trigger

For embedded buttons/forms on your site

Page Trigger lets you embed AgentCraft webhooks directly into your website or app. Unlike User Trigger or Timer Trigger, the Page Trigger runs from your page via our JavaScript SDK. It’s perfect for sign-up fsign-up forms, lead capture forms, or any action a visitor performs on your site.

How It Works

  1. AgentCraft issues a JWT token to the end-user via redirect (URL parameter).

  2. Our JS SDK automatically extracts this token.

  3. When a user submits your form or clicks a button, the SDK sends a fetch() request to the proxy webhook with the token in the Authorization header.

  4. AgentCraft validates the token and forwards the request to your original webhook.

Step 1. Include the AgentCraft SDK

Add our script to your page (before </body> closing tag):

Step 2. Embed a Form with data-agentcraft-webhook

Wrap your form fields with a form tag and point it to your AgentCraft Page Trigger webhook:

Token Handling

  • When the user is redirected to your page from AgentCraft, the URL will contain ?agentcraft_token=<JWT>

  • The SDK automatically extracts this token.

  • The token is then sent as Authorization: Bearer <token> with each request.


Notes about Page Trigger

  • No static/dynamic fields. Page Trigger simply proxies everything you send.

  • Invisible to the end-user. It doesn’t appear in /end-user/webhook because end-users don’t configure it — only you do.

  • Flexible. You can attach it to forms, buttons, or custom JS events.

Debugging Responses

Include a <div data-agentcraft-result></div> inside your form. The SDK will automatically populate it with the webhook response (JSON or text).

Typical Use Cases

  • Signup / lead forms

  • In-page actions (like “Generate Report” buttons)

  • Lightweight API calls on behalf of a logged-in user

Last updated