LooonaDocslooona.com ↗

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

  1. Build the form in Looona

    Its questions set what your code can send.

  2. Publish it

    Only a live form takes answers.

  3. 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.

Terminal
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. pageUrl when the form collects the page, and userIdentifier and groupIdentifier when it lets your site say who is answering.

Answers by type

QuestionSend
Short answer, EmailA string, 500 characters at most.
Long answerA string, 10,000 characters at most.
Single choiceThe option's label, as written.
Multiple choiceA list of labels.
RatingA number in its range.

Leave an optional question out, or send null.

The answer

StatusMeans
201Received. Looona sends it to the destination after answering.
400Some answers need a fix. fieldErrors gives one code per identifier: required, invalid_email, invalid_choice or too_long.
404No live form has this link.
410The form is closed.
409You sent the form's version, and the form changed since. The answer holds the new version.
429Too many answers from this address: 60 every 10 minutes per form.
403Looona 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.