Self-host & build › Developers › Send answers from your own code
Send answers from your own code
Build your own form on your site and send its answers to a Looona form, without a key.
You can build the form yourself, in your site's own design, and send its answers to a Looona form. The responses then work like any other: Inbox, destination, layout.
No key is needed: the form's link is the only identifier.
Before you start
- Build the form in Looona
Its questions set what your code can send.
- Publish it
Only a live form takes answers.
- Allow your site
In the form's Settings, under Advanced, turn on Allow sending from your own site, then publish. Without it, browsers on other sites can't send.
Find the identifiers
Each answer is sent under its question's Identifier, from the question's Advanced settings. For example summary, severity and email.
The request
<id> is the end of the form's link, /f/<id>, and https://feedback.acme.com stands for your Looona address. On looona.com, it's https://forms.looona.com.
curl https://feedback.acme.com/api/public/forms/<id>/submissions \
-X POST \
-H 'Content-Type: application/json' \
--data-raw '{
"submissionId": "6f2b8c1e-3d4a-4e9b-8a7c-5d1e0f9b2a36",
"answers": {
"summary": "Export to CSV freezes on big projects",
"severity": "Blocks my work",
"email": "[email protected]"
},
"context": { "pageUrl": "https://app.acme.com/projects" }
}'
submissionId: a new UUID for each answer. Sending the same one twice stores it once, so a retry is safe.answers: the form's identifiers only.context: optional.pageUrlwhen the form collects the page, anduserIdentifierandgroupIdentifierwhen it lets your site say who is answering.
Answers by type
| Question | Send |
|---|---|
| Short answer, Email | A string, 500 characters at most. |
| Long answer | A string, 10,000 characters at most. |
| Single choice | The option's label, as written. |
| Multiple choice | A list of labels. |
| Rating | A number in its range. |
Leave an optional question out, or send null.
The answer
| Status | Means |
|---|---|
201 | Received. Looona sends it to the destination after answering. |
400 | Some answers need a fix. fieldErrors gives one code per identifier: required, invalid_email, invalid_choice or too_long. |
404 | No live form has this link. |
410 | The form is closed. |
409 | You sent the form's version, and the form changed since. The answer holds the new version. |
429 | Too many answers from this address: 60 every 10 minutes per form. |
403 | Looona can't take answers right now. |
To read the form's questions from your code, GET /api/public/forms/<id> gives the live version, with its version number. Send that number back as version to hear about a change instead of sending stale answers.