After a submission
Once a visitor's submission is stored, the form type's afterSubmission()
queues the email notifications and the form's integrations.
A submission created in code, by a seeder or an import, triggers neither.
To react to every form a visitor sends, whatever its type, listen for
VanOns\FilamentFormBuilder\Events\FormSubmission\FormSubmitted. It fires after
afterSubmission(), with the stored submission as $event->formSubmission.
FormSubmissionCreated fires for every stored submission, also one made in
code. Both models fire an event for every change: FormCreated,
FormUpdated, FormDeleted, FormRestored and FormForceDeleted in
Events\Form, and the same for a submission in Events\FormSubmission.
Email notifications
The Notifications tab shows a form's emails as cards, under what the visitor sees after sending: who they go to, when, and how often they went out. A notification is edited in a slide-over:
- To: fields of the form that hold an email address, or addresses typed in. A choice whose every option is an address counts too, so a mail can go to the branch a visitor picks. Every recipient gets a mail of their own.
- CC and BCC: the same kind of recipients, getting a copy of each of those mails; an address the mail is already for gets no copy of it.
- Reply to: a field or an address, so a reply goes to the person who sent the form.
- Sending: always, or only when the answers meet conditions, the same rules fields use to show.
- Attachments: the uploads go along up to
uploads.attach_max_sizekilobytes together; larger ones stay a link. - A switch on the card turns a notification off without deleting it, and Test mail to me sends it, filled in with the latest submission, to the person editing it.
On a form that already exists, saving, switching, duplicating or deleting a notification stores it straight away; a form being created keeps them until it is saved.
Every mail goes out from a SendFormNotificationJob of its own, so like the
integrations it needs a queue worker unless the queue is sync. The
submission's page lists each mail as queued, sent or failed, with the error.
email_notifications set to false in the config, or hasNotifications()
returning false on a form type, leaves the emails out of the Notifications tab
and sends none.
A new notification starts empty, as a confirmation to the person who sent the
form, or as a message for staff with every answer and a link to the
submission. A field type of your own offers its email columns as recipients
in getEmailColumns().
Merge tags
The subject, the content and the sender name of an email notification take
merge tags. The editor's tag button opens a picker that groups them and
searches as you type, and typing {{ in the text offers them too: every answer
of the form by its label, the form title, all fields as one block, the
submission's number and date, the page it was sent from, and a link to the
submission in the panel. They are stored as
Filament's merge tag nodes and filled in when the mail is sent, each answer
escaped. A tag for a field the form no longer has stays empty, and the email
tab warns about it.
Content written before merge tags holds {{ $key }} as text. It is still read
as the same tag, and the editor shows it as one once the form is opened.
A project adds tags of its own, such as the site's name or a number it gives a
submission, in a service provider's boot(). The editors offer them under
"Other", in the mails, the thank-you message and the redirect query alike, and
no field can take their key:
FilamentFormBuilderPlugin::mergeTag(
'site_name',
label: 'Site name',
value: fn (FormSubmission $submission): string => config('app.name'),
icon: Heroicon::OutlinedGlobeAlt,
);The closure runs for every mail and thank-you message, so keep it cheap; it gives text, which is escaped like an answer.
Integrations
The Integrations tab passes every submission on to another system. Each
integration is a card that shows what it sends, when it runs, and how often it
succeeded or failed lately. Add integration has a tile for every type in
the integrations config, so an editor picks the type straight away. Its
slide-over holds the integration's own settings, the fields it asks of the
form, and when it runs: always, or only when the answers meet conditions. A
switch turns one off without deleting it, and on a form that already exists
every change is stored straight away.
Each integration that is on gets a RunFormIntegrationJob of its own once a
visitor sends the form, so the app needs a queue worker unless the queue is
sync. One whose conditions leave it out is logged as skipped. When an
integration throws, the job tries again after ten seconds and after a minute;
when it calls fail(), it stops at once. The submission's page shows how each
integration went, what came back, and Run again.
The webhook
WebhookIntegration posts every submission as JSON to a URL, such as one of
n8n or Zapier:
'integrations' => [
VanOns\FilamentFormBuilder\Integrations\WebhookIntegration::class,
],It can sign in with a bearer token, a username and password, or a header of your own, stored encrypted. Its slide-over shows the JSON the latest submission would send:
{
"form": {"id": 4, "title": "Contact"},
"submission": {
"id": 214,
"submitted_at": "2026-10-07T15:58:12+02:00",
"source_url": "https://example.com/contact",
"url": "https://example.com/admin/form-submissions/214"
},
"data": {"voornaam": "Jan", "email": "jan@example.com"},
"labels": {"voornaam": "Voornaam", "email": "E-mailadres"}
}An answer in the 400s fails for good; one in the 500s, or none at all, is tried again. Send test posts the latest submission once, without logging it.
The URL has to lead to the public internet: a host that resolves to localhost,
a private network or a reserved address, also after a redirect, fails without
a request. Set webhook.allow_private_network to true for a receiver beside
the app, such as n8n on the same server.
Writing an integration
An integration extends VanOns\FilamentFormBuilder\Classes\Integration and
is added to the integrations config:
use BackedEnum;
use Filament\Forms\Components\Select;
use Filament\Support\Icons\Heroicon;
use Illuminate\Support\Facades\Http;
use VanOns\FilamentFormBuilder\Classes\Integration;
use VanOns\FilamentFormBuilder\Classes\MappedField;
class NewsletterIntegration extends Integration
{
public static function label(): string
{
return 'Newsletter';
}
public static function description(): ?string
{
return 'Puts the person who sent the form on a mailing list.';
}
public static function icon(): string|BackedEnum
{
return Heroicon::OutlinedNewspaper;
}
public static function schema(): array
{
return [
Select::make('list')->options(['customers' => 'Customers'])->required(),
static::secretInput('api_key')->required(),
];
}
public static function fields(): array
{
return [
MappedField::make('email', 'Email')->email()->required(),
MappedField::make('first_name', 'First name'),
MappedField::make('note', 'Note')->text(),
];
}
public static function summary(array $integration): ?string
{
return 'List ' . ($integration['list'] ?? '');
}
public function handle(): void
{
$response = Http::withToken($this->secret('api_key'))
->post("https://api.example.com/lists/{$this->setting('list')}/members", $this->mapped());
if ($response->serverError()) {
$response->throw();
}
if ($response->failed()) {
$this->fail($response->json('message', 'Not subscribed.'), $response->json());
return;
}
$this->setResponse($response->json());
}
}| Method | What it is for |
|---|---|
label(), description(), icon() | Its tile and its card |
schema() | Its own settings, stored on the form; setting() reads one. secretInput() stores what is typed encrypted and secret() reads it back. A SettingsGroup in it gets a heading of its own. A setting cannot be named id, class, enabled, mapping, conditions or conditionMatch. |
fields() | What it asks of the form. A MappedField is a select of the form's fields, filled in by name for a new integration; email() offers the fields with an email address only, text() makes it a line of text with merge tags. mapped() gives the answers as the export shows them, mapped(raw: true) as stored. |
summary() | A line under its name on the card |
hasConditions() | false leaves out when it runs, for one that must always run |
isTestable() | true adds Send test; only for one that does no harm when it runs once more |
handle() | Sends the submission on, in $this->formSubmission. setResponse() keeps what came back for the submission's page; fail() ends the run as failed without trying again; an exception is tried again. |
