Check packet completion status
Goal
Determine whether a Patient has finished all the Forms in a Packet you sent them.
Response objects don't have a status field, and there's no
GET /v2/packet_responses list/retrieve endpoint. Completion is read from
the is_submitted / submitted_at fields on each
Response, filtered by
Packet Response or by patient and
packet.
Prerequisites
- An API key pair, see Authentication.
- A Packet already sent to a Patient (see Send an intake packet to a patient).
Steps
1. Get the packet_response id, if you have it
If you kept the Message you created to send the Packet, re-fetch it, once
the Patient opens the Packet, the Message's packet_response field is
populated:
curl --request GET \
--url https://api.app.zentake.com/v2/messages/<message_id> \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <your_api_key>' \
--header 'X-API-SECRET: <your_api_secret>'
2. List the Responses for that packet send
With a packet_response id:
curl --request GET \
--url 'https://api.app.zentake.com/v2/responses?packet_response=<packet_response_id>' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <your_api_key>' \
--header 'X-API-SECRET: <your_api_secret>'
Without a packet_response id yet, filter by patient and packet instead:
curl --request GET \
--url 'https://api.app.zentake.com/v2/responses?patient=<patient_id>&packet=<packet_id>' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <your_api_key>' \
--header 'X-API-SECRET: <your_api_secret>'
Other useful filters on this endpoint: form, document,
submitted_after / submitted_before / submitted_on. See
Get responses for the full list.
3. Read is_submitted / submitted_at
Each Response in the results has its own is_submitted (boolean) and
submitted_at (timestamp once submitted). A Packet is complete once
every Form in the Packet has a Response with is_submitted: true,
compare the count and ids of returned responses against the Packet's
forms array (Get packet by id).
For the full nested answer payload of any one Response, retrieve it individually:
curl --request GET \
--url https://api.app.zentake.com/v2/responses/<response_id> \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <your_api_key>' \
--header 'X-API-SECRET: <your_api_secret>'
What success looks like
- One Response per Form in the Packet, each with
is_submitted: trueand a non-nullsubmitted_at. - If some Responses are missing or
is_submitted: false, the Patient hasn't finished the Packet yet,form_indexon the parent Packet Response (visible in the webhook payload, see Webhook payloads) shows roughly how far they've gotten.
Repeatedly polling this endpoint works, but a
completion webhook tells
you the moment a packet_response or response is submitted, without
the delay or extra requests of polling.