> For the complete documentation index, see [llms.txt](https://guide.fariaedu.com/integrations-portal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.fariaedu.com/integrations-portal/openapply/public-rest-apis/v3/whats-app.md).

# Whats App

This page describes the APIs relating to WhatsApp conversations, form submissions and usage. They return metadata only: never message text, form answers, phone numbers, WhatsApp names or attachments. Available to schools with the WhatsApp module enabled; otherwise they answer 403.

## Get all WhatsApp Conversations

> One record per WhatsApp conversation (a 1:1 thread between the school and one family), with\
> metadata only. \`id\` is stable and opaque. Families are identified by the Contact, Parent and\
> Student ids the rest of the API returns; several parents may share one number, so ids are\
> arrays. \`first\_response\_seconds\` runs from the family's first message to the first reply a\
> staff member sent, and is null while the school has not replied. \`awaiting\_reply\` is true\
> when the last message came from the family. \`form\` names the WhatsApp Form the conversation\
> started with, or is null. Results are paginated via \`page\` and \`per\_page\`. \`since\_date\`\
> selects by message time only: a change to the linked ids alone does not count.\
> \
> Timestamps and dates are in UTC unless the school has "Use school timezone" enabled for the API, in which case they follow the school timezone.<br>

```json
{"openapi":"3.0.1","info":{"title":"openapply","version":"3.0.0"},"tags":[{"name":"WhatsApp","description":"This page describes the APIs relating to WhatsApp conversations, form submissions and usage. They return metadata only: never message text, form answers, phone numbers, WhatsApp names or attachments. Available to schools with the WhatsApp module enabled; otherwise they answer 403."}],"servers":[{"url":"https://api.openapply.com","description":"CAN region auth server"},{"url":"https://api.openapply.cn","description":"CN region auth server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v3/whatsapp/conversations":{"get":{"summary":"Get all WhatsApp Conversations","tags":["WhatsApp"],"operationId":"listWhatsappConversations","description":"One record per WhatsApp conversation (a 1:1 thread between the school and one family), with\nmetadata only. `id` is stable and opaque. Families are identified by the Contact, Parent and\nStudent ids the rest of the API returns; several parents may share one number, so ids are\narrays. `first_response_seconds` runs from the family's first message to the first reply a\nstaff member sent, and is null while the school has not replied. `awaiting_reply` is true\nwhen the last message came from the family. `form` names the WhatsApp Form the conversation\nstarted with, or is null. Results are paginated via `page` and `per_page`. `since_date`\nselects by message time only: a change to the linked ids alone does not count.\n\nTimestamps and dates are in UTC unless the school has \"Use school timezone\" enabled for the API, in which case they follow the school timezone.\n","parameters":[{"name":"page","in":"query","required":false,"description":"The page number of results to return.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","required":false,"description":"Request for how many records to return.","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"count","in":"query","required":false,"description":"Synonym for per_page","schema":{"type":"integer"}},{"name":"started_from","in":"query","required":false,"description":"Only conversations whose first message is on or after this date.","schema":{"type":"string","format":"date"}},{"name":"started_to","in":"query","required":false,"description":"Only conversations whose first message is on or before this date.","schema":{"type":"string","format":"date"}},{"name":"since_date","in":"query","required":false,"description":"Only conversations with a message after this point in time. A change to the linked ids alone, such as a Contact converting, does not count.","schema":{"type":"string","format":"date_time"}}],"responses":{"200":{"description":"successful","content":{"application/json":{"schema":{"type":"object","properties":{"conversations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Stable, opaque conversation id (the id of its first message). Not personal data."},"started_at":{"type":"string","format":"date_time","description":"When the first message in either direction was sent or received. A conversation usually opens with the family's message, but can open with a staff reply."},"last_message_at":{"type":"string","format":"date_time","description":"When the most recent message in either direction was sent or received."},"inbound_count":{"type":"integer","description":"Messages received from the family over the whole conversation, whatever the filter dates."},"outbound_count":{"type":"integer","description":"Messages sent by the school over the whole conversation, including the automatic Flow invitation."},"first_response_seconds":{"type":"integer","nullable":true,"description":"Seconds from the family's first message to the first reply a staff member sent. Automatic sends do not count. Null while nobody has replied."},"awaiting_reply":{"type":"boolean","description":"True when the last message came from the family."},"parent_ids":{"type":"array","items":{"type":"integer"},"description":"Parents whose mobile number this is, or who were identified as the sender of a message in it (several parents may share a number)."},"contact_ids":{"type":"array","items":{"type":"integer"},"description":"Contacts whose mobile number this is, or that a form in this conversation created or updated."},"student_ids":{"type":"array","items":{"type":"integer"},"description":"Students of the linked parents."},"replied_by_staff_ids":{"type":"array","items":{"type":"integer"},"description":"Staff user ids who replied in this conversation."},"form":{"type":"object","nullable":true,"description":"The WhatsApp Form the conversation started with, or null.","properties":{"id":{"type":"integer","description":"WhatsApp Form id."},"name":{"type":"string","description":"WhatsApp Form name, as the school named it."}}}}},"description":"Ordered by id, oldest first."},"meta":{"type":"object","description":"Pagination, as on the other v3 lists.","properties":{"page":{"type":"integer","description":"The page returned."},"pages":{"type":"integer","description":"Pages at this per_page; 1 for an empty list."},"per_page":{"type":"integer","description":"Records per page."}}}}}}}},"400":{"description":"invalid parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"401":{"description":"missing or invalid bearer token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"403":{"description":"WhatsApp is not enabled for this school","content":{"application/json":{}}}}}}}}
```

## Get all WhatsApp Form Submissions

> One record per completed WhatsApp Form a family sent in, with metadata only: the form, when\
> it arrived, the conversation it belongs to, and the Contact it created (\`outcome: created\`)\
> or updated (\`outcome: updated\`). \`student\_ids\` lists the students of a Contact that has since\
> become an applicant. Form answers are never returned. Results are paginated via \`page\` and\
> \`per\_page\`.\
> \
> Timestamps and dates are in UTC unless the school has "Use school timezone" enabled for the API, in which case they follow the school timezone.<br>

```json
{"openapi":"3.0.1","info":{"title":"openapply","version":"3.0.0"},"tags":[{"name":"WhatsApp","description":"This page describes the APIs relating to WhatsApp conversations, form submissions and usage. They return metadata only: never message text, form answers, phone numbers, WhatsApp names or attachments. Available to schools with the WhatsApp module enabled; otherwise they answer 403."}],"servers":[{"url":"https://api.openapply.com","description":"CAN region auth server"},{"url":"https://api.openapply.cn","description":"CN region auth server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v3/whatsapp/form_submissions":{"get":{"summary":"Get all WhatsApp Form Submissions","tags":["WhatsApp"],"operationId":"listWhatsappFormSubmissions","description":"One record per completed WhatsApp Form a family sent in, with metadata only: the form, when\nit arrived, the conversation it belongs to, and the Contact it created (`outcome: created`)\nor updated (`outcome: updated`). `student_ids` lists the students of a Contact that has since\nbecome an applicant. Form answers are never returned. Results are paginated via `page` and\n`per_page`.\n\nTimestamps and dates are in UTC unless the school has \"Use school timezone\" enabled for the API, in which case they follow the school timezone.\n","parameters":[{"name":"page","in":"query","required":false,"description":"The page number of results to return.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","required":false,"description":"Request for how many records to return.","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"count","in":"query","required":false,"description":"Synonym for per_page","schema":{"type":"integer"}},{"name":"submitted_from","in":"query","required":false,"description":"Only submissions received on or after this date.","schema":{"type":"string","format":"date"}},{"name":"submitted_to","in":"query","required":false,"description":"Only submissions received on or before this date.","schema":{"type":"string","format":"date"}},{"name":"since_date","in":"query","required":false,"description":"Only submissions received after this point in time. A later change to the Contact, such as student_ids filling in once it converts, does not count.","schema":{"type":"string","format":"date_time"}}],"responses":{"200":{"description":"successful","content":{"application/json":{"schema":{"type":"object","properties":{"form_submissions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Submission id."},"conversation_id":{"type":"integer","description":"The conversation the form arrived in (see /whatsapp/conversations)."},"submitted_at":{"type":"string","format":"date_time","description":"When the completed form arrived."},"contact_id":{"type":"integer","description":"The Contact this submission created or updated."},"student_ids":{"type":"array","items":{"type":"integer"},"description":"Students of the Contact, once it has become an applicant. Empty until then."},"outcome":{"type":"string","enum":["created","updated"],"description":"Whether the submission created a new Contact or updated an existing one."},"form":{"type":"object","nullable":true,"description":"The WhatsApp Form involved, or null. Forms are not a resource of this API, so the name travels with the id.","properties":{"id":{"type":"integer","description":"WhatsApp Form id."},"name":{"type":"string","description":"WhatsApp Form name, as the school named it."}}}}},"description":"Ordered by id, oldest first."},"meta":{"type":"object","description":"Pagination, as on the other v3 lists.","properties":{"page":{"type":"integer","description":"The page returned."},"pages":{"type":"integer","description":"Pages at this per_page; 1 for an empty list."},"per_page":{"type":"integer","description":"Records per page."}}}}}}}},"400":{"description":"invalid parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"401":{"description":"missing or invalid bearer token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"403":{"description":"WhatsApp is not enabled for this school","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}}}}
```

## Get the WhatsApp Usage Summary

> Totals per day, week (starting Monday) or month across a date range. Each bucket counts the\
> conversation and form submission records the two lists return for the same dates:\
> conversations by the date they started, messages by the date they were sent or received,\
> form submissions by the date they arrived, \`contacts\_created\` by the date a WhatsApp Form\
> created the Contact (a Contact whose form has since been deleted is not counted) and\
> \`contacts\_converted\` by the date the Parent such a Contact converted into was created.\
> The first and last buckets may extend beyond \`from\` and \`to\` but count only the dates\
> inside the range.\
> \`first\_response\_average\_seconds\` and \`first\_response\_median\_seconds\` cover the conversations\
> that started in the bucket and have been replied to; both are null when none has.\
> \
> Message counts follow the date of each message, while a conversation's \`inbound\_count\` and\
> \`outbound\_count\` cover the whole conversation. A bucket's \`messages\_received\` therefore need not\
> equal the \`inbound\_count\` of the conversations started in it; over the whole history the two agree.\
> \
> Timestamps and dates are in UTC unless the school has "Use school timezone" enabled for the API, in which case they follow the school timezone. Buckets are cut in that same timezone.<br>

```json
{"openapi":"3.0.1","info":{"title":"openapply","version":"3.0.0"},"tags":[{"name":"WhatsApp","description":"This page describes the APIs relating to WhatsApp conversations, form submissions and usage. They return metadata only: never message text, form answers, phone numbers, WhatsApp names or attachments. Available to schools with the WhatsApp module enabled; otherwise they answer 403."}],"servers":[{"url":"https://api.openapply.com","description":"CAN region auth server"},{"url":"https://api.openapply.cn","description":"CN region auth server"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v3/whatsapp/usage":{"get":{"summary":"Get the WhatsApp Usage Summary","tags":["WhatsApp"],"operationId":"getWhatsappUsage","description":"Totals per day, week (starting Monday) or month across a date range. Each bucket counts the\nconversation and form submission records the two lists return for the same dates:\nconversations by the date they started, messages by the date they were sent or received,\nform submissions by the date they arrived, `contacts_created` by the date a WhatsApp Form\ncreated the Contact (a Contact whose form has since been deleted is not counted) and\n`contacts_converted` by the date the Parent such a Contact converted into was created.\nThe first and last buckets may extend beyond `from` and `to` but count only the dates\ninside the range.\n`first_response_average_seconds` and `first_response_median_seconds` cover the conversations\nthat started in the bucket and have been replied to; both are null when none has.\n\nMessage counts follow the date of each message, while a conversation's `inbound_count` and\n`outbound_count` cover the whole conversation. A bucket's `messages_received` therefore need not\nequal the `inbound_count` of the conversations started in it; over the whole history the two agree.\n\nTimestamps and dates are in UTC unless the school has \"Use school timezone\" enabled for the API, in which case they follow the school timezone. Buckets are cut in that same timezone.\n","parameters":[{"name":"period","in":"query","required":true,"description":"Bucket size. Weeks start on Monday, months on the 1st.","schema":{"type":"string","enum":["day","week","month"]}},{"name":"from","in":"query","required":true,"description":"First date of the range, inclusive.","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":true,"description":"Inclusive. At most 366 days after `from`; a longer range answers 400.","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"successful","content":{"application/json":{"schema":{"type":"object","properties":{"buckets":{"type":"array","items":{"type":"object","properties":{"starts_on":{"type":"string","format":"date","description":"First day of the bucket (the day itself, the Monday of the week, or the 1st of the month). The first and last buckets may extend beyond from and to but count only the dates inside the range."},"conversations_started":{"type":"integer","description":"Conversations whose first message arrived in the bucket."},"messages_received":{"type":"integer","description":"Messages received from families in the bucket, counted by the date each message arrived — not the inbound_count of the conversations started in the bucket."},"messages_sent":{"type":"integer","description":"Messages sent by the school in the bucket, counted by the date each message was sent — not the outbound_count of the conversations started in the bucket."},"form_submissions":{"type":"integer","description":"Completed WhatsApp Forms that arrived in the bucket."},"contacts_created":{"type":"integer","description":"Contacts a WhatsApp Form created in the bucket. A Contact whose form has since been deleted is not counted."},"contacts_converted":{"type":"integer","description":"Contacts created from WhatsApp that became applicants in the bucket, dated by when the Parent they converted into was created."},"first_response_average_seconds":{"type":"integer","nullable":true,"description":"Mean first response time of the conversations started in the bucket that have been replied to. Null when none has."},"first_response_median_seconds":{"type":"integer","nullable":true,"description":"Median of the same."}}},"description":"One per period in the range, oldest first, including empty ones."},"meta":{"type":"object","description":"The request as understood.","properties":{"period":{"type":"string","enum":["day","week","month"],"description":"Bucket size."},"from":{"type":"string","format":"date","description":"First date of the range."},"to":{"type":"string","format":"date","description":"Last date of the range."}}}}}}}},"400":{"description":"invalid parameter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"401":{"description":"missing or invalid bearer token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"403":{"description":"WhatsApp is not enabled for this school","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}}}}
```
