Website form to the CRM
Post a form to an automation's webhook, which files a task for the team and emails them.
A contact form on your website posts to a Flito automation. The automation files a task for the sales team and emails them the request. No API key is involved: the webhook URL is the secret.
The automation
In the app, make an automation with the trigger Webhook received, generate its URL (see Webhooks), and give it two steps:
[
{
"id": "task",
"type": "action",
"capabilityId": "task.create",
"input": {
"title": "Call {{trigger.body.name}} from {{trigger.body.company|their company}}",
"description": "{{trigger.body.email}}: {{trigger.body.message}}",
"priority": "high"
}
},
{
"id": "tell-sales",
"type": "action",
"capabilityId": "email.send",
"input": {
"toAddress": "sales@yourcompany.com",
"sendType": "transactional",
"subject": "Website request from {{trigger.body.name}}",
"body": "<p>{{trigger.body.name}} ({{trigger.body.email}}) wrote:</p><p>{{trigger.body.message}}</p>"
}
}
]Switch it on.
The form
Post from your server, so the URL stays private:
// Your site's form handler, for example a route in Next.js or Express.
export async function POST(request) {
const form = await request.formData()
const res = await fetch(process.env.FLITO_FORM_WEBHOOK, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
// One key per submission, so a retry never files it twice.
'X-Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
name: form.get('name'),
email: form.get('email'),
company: form.get('company'),
message: form.get('message'),
}),
})
return Response.json({ ok: res.ok }, { status: res.ok ? 200 : 502 })
}FLITO_FORM_WEBHOOK holds the URL from the automation.
Check it
Submit the form once, then look at the automation's run history in the app, or call workflow.runs with its id: the run shows each step and what it returned.
Was this page useful?