Skip to main content

Submitting from an Integration

An OAuth 2.0 integration can send feedback it collects into Harlyy as survey submissions, for example from its own app, kiosk or ordering flow. It creates a submission, fills it in, and can retrieve it again by its ID. Integrations can't list a business's submissions.

Access​

Your app needs the submissions scope, along with openid, which every integration needs.

Your app acts as the user who signed in, so that user needs the right permissions in the business:

RequestPermission needed
Create a submissionWrite access to submissions.
Update a submissionWrite access to submissions.
Retrieve a submissionRead access to submissions, and access to the submission's survey and location.

Requests the user doesn't have permission for respond with 403 Forbidden.

Creating a Submission​

Create the submission in the survey, with any answers you already have:

Create Request
POST https://api.harlyy.com/v2/businesses/{business}/surveys/{survey}/submissions
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

{
"location": "loc_679df4c92804706b120330d1",
"code": "order-10482",
"steps": [
{ "step": "stp_67a1b2c3d4e5f6a7b8c9d0e1", "rating": 5 },
{ "step": "stp_67a1b2c3d4e5f6a7b8c9d0e2", "text": "Quick service and friendly staff." }
]
}
  • location: The location the feedback is about.
  • code: Optional. Your own ID for the feedback, such as an order number. Harlyy only accepts one submission per code in each survey, so a retried request can't create a duplicate.
  • steps: The answers, one per survey step, by the step's ID.

Every submission starts with the status editing. Keep its id from the response, as it's the only way to update or retrieve the submission later.

If you create a submission with a code that's already in use, Harlyy responds with the existing submission while it's still editing, or with 423 Locked once it's finished.

Updating a Submission​

Send only the fields that changed. A step you send replaces the answer already saved for that step:

Update Request
PATCH https://api.harlyy.com/v2/businesses/{business}/surveys/{survey}/submissions/{submission}
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

{
"steps": [
{ "step": "stp_67a1b2c3d4e5f6a7b8c9d0e3", "metrics": ["met_67a1b2c3d4e5f6a7b8c9d0f1"] }
],
"status": "completed"
}

A submission can only be filled in while it's editing, and for up to 30 minutes after it was created:

  • Set status to completed once all the answers are in. Harlyy then processes the feedback, including any incidents, alerts and rewards.
  • A submission that isn't updated for 10 minutes is finished automatically: it's completed if it has enough answers, or abandoned if it doesn't.
  • A finished submission can't be filled in any more, and responds with 423 Locked.

You can also reject a completed or abandoned submission as fake by setting status to rejected, with no other fields in the request. Rejected submissions are left out of analytics, and don't raise incidents or earn rewards.

Retrieving a Submission​

Retrieve a submission by its ID, from the survey it was created in:

Retrieve Request
GET https://api.harlyy.com/v2/businesses/{business}/surveys/{survey}/submissions/{submission}
Authorization: Bearer ACCESS_TOKEN

Surveys That Can't Take Integration Submissions​

Some survey settings are meant for customers submitting on their own devices, and stop an integration from creating submissions:

  • Signed links required. Send a valid signed link signature in the x-signature header, or turn the setting off.
  • Submission limits. A survey that limits submissions per device only takes submissions from registered devices. Use a survey without a limit.

Rate Limits​

Creating submissions is limited for each survey, to 10 requests a minute for each user, and 50 a minute across all of your app's users. Every response has X-RateLimit-* and X-Integration-RateLimit-* headers with the limit, the requests remaining, and when it resets. A request over the limit responds with 429 Too Many Requests.