> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morf.health/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Message Thread

> Event payload details and trigger documentation for Message Thread data from Elation

<img src="https://mintcdn.com/morfhealth/EU2WCxuXGIUQcziR/images/elation.svg?fit=max&auto=format&n=EU2WCxuXGIUQcziR&q=85&s=06d58e76eb0b3a5e191b8fc13f4ba68a" alt="images/elation.svg" width="40" height="40" data-path="images/elation.svg" />

# Events

## Triggering Webhook Types

The following event types are associated with the Message Thread event payload from Elation.

* `Elation Message Thread Updated`
* `Elation Message Thread Deleted`

<RequestExample>
  ```json Example theme={null}
  {
    "added_to_chart_at": "2021-05-05T22:02:09Z",
    "created_at": "2021-05-05T22:02:10Z",
    "deleted_at": "",
    "id": "140754787631195",
    "is_urgent": false,
    "members": [
      {
        "acked_at": "",
        "group_id": "851981",
        "id": "346292316",
        "status": "THREAD_MEMBER_STATUS_ADDRESSED",
        "thread_id": "346226779",
        "user_id": "6"
      }
    ],
    "messages": [
      {
        "associated_document": {
          "added_to_chart_at": "2014-01-24T18:13:48Z",
          "authoring_practice_id": "65540",
          "created_at": "2014-01-24T18:13:48Z",
          "deleted_at": "",
          "document_timestamp": "2014-01-24T18:59:15Z",
          "document_type": 91,
          "id": "64077889627",
          "last_modified_at": "2016-05-02T18:53:12Z",
          "patient_id": "64072843265",
          "signed_at": "2014-01-24T18:13:48Z",
          "signed_by": "4"
        },
        "body": "Patient should have appointment already booked.",
        "id": "346423390",
        "patient_id": "342753281",
        "practice_id": "655364",
        "sender_id": "6",
        "sent_at": "2021-10-19T19:08:48",
        "thread_id": "346226779"
      }
    ],
    "patient_id": "140754786975745",
    "practice_id": "140754817318916",
    "thread_document_created_at": "2021-05-05T22:02:09Z"
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Description theme={null}
  {
    "added_to_chart_at": "Date and time when the thread was added to the patient's chart.",
    "created_at": "Timestamp when the message thread was created.",
    "deleted_at": "Timestamp when the message thread was deleted, if applicable.",
    "id": "Unique identifier for the message thread.",
    "is_urgent": "Flag indicating whether this thread is marked as urgent.",
    "members": {
      "acked_at": "Timestamp when the member acknowledged the thread, if applicable.",
      "group_id": "ID of the group, if this member represents a group.",
      "id": "Unique identifier for the thread member.",
      "status": "Current status of the member in this thread.",
      "thread_id": "ID of the thread this member belongs to.",
      "user_id": "ID of the user, if this member represents a user."
    },
    "messages": {
      "associated_document": {
        "added_to_chart_at": "Date and time when the document was added to the chart.",
        "authoring_practice_id": "ID of the practice that authored this document.",
        "created_at": "Timestamp when the document was created.",
        "deleted_at": "Timestamp when the document was deleted, if applicable.",
        "document_timestamp": "Date and time of the document.",
        "document_type": "Type identifier for the document.",
        "id": "Unique identifier for the document.",
        "last_modified_at": "Timestamp when the document was last modified.",
        "patient_id": "ID of the patient this document belongs to.",
        "signed_at": "Timestamp when the document was signed.",
        "signed_by": "ID of the user who signed the document."
      },
      "body": "Content of the message. Must not be empty.",
      "id": "Unique identifier for the message.",
      "patient_id": "ID of the patient this message relates to.",
      "practice_id": "ID of the practice this message belongs to.",
      "sender_id": "ID of the user who sent this message.",
      "sent_at": "Timestamp when the message was sent.",
      "thread_id": "ID of the thread this message belongs to."
    },
    "patient_id": "ID of the patient this thread belongs to.",
    "practice_id": "ID of the practice this thread belongs to.",
    "thread_document_created_at": "Date and time when the thread document was created."
  }
  ```
</ResponseExample>

### Payload Field Details

<ResponseField name="Message Thread" type="Event Payload">
  <Expandable title="fields" defaultOpen="true">
    <ResponseField name="id" type="string" required>
      Unique identifier for the message thread.

      ```json CEL theme={null}
      id
      ```

      ```json Example theme={null}
      "140754787631195"
      ```
    </ResponseField>

    <ResponseField name="created_at" type="timing.v1.Timestamp" required>
      Timestamp when the message thread was created.

      ```json CEL theme={null}
      created_at
      ```

      ```json Example theme={null}
      "2021-05-05T22:02:10Z"
      ```
    </ResponseField>

    <ResponseField name="deleted_at" type="timing.v1.Timestamp">
      Timestamp when the message thread was deleted, if applicable.

      ```json CEL theme={null}
      deleted_at
      ```

      ```json Example theme={null}
      ""
      ```
    </ResponseField>

    <ResponseField name="thread_document_created_at" type="timing.v1.Timestamp" required>
      Date and time when the thread document was created.

      ```json CEL theme={null}
      thread_document_created_at
      ```

      ```json Example theme={null}
      "2021-05-05T22:02:09Z"
      ```
    </ResponseField>

    <ResponseField name="added_to_chart_at" type="timing.v1.Timestamp" required>
      Date and time when the thread was added to the patient's chart.

      ```json CEL theme={null}
      added_to_chart_at
      ```

      ```json Example theme={null}
      "2021-05-05T22:02:09Z"
      ```
    </ResponseField>

    <ResponseField name="patient_id" type="string" required>
      `ID` ID of the patient this thread belongs to.

      ```json CEL theme={null}
      patient_id
      ```

      ```json Example theme={null}
      "140754786975745"
      ```
    </ResponseField>

    <ResponseField name="practice_id" type="string" required>
      ID of the practice this thread belongs to.

      ```json CEL theme={null}
      practice_id
      ```

      ```json Example theme={null}
      "140754817318916"
      ```
    </ResponseField>

    <ResponseField name="is_urgent" type="bool" required>
      Flag indicating whether this thread is marked as urgent.

      ```json CEL theme={null}
      is_urgent
      ```

      ```json Example theme={null}
      false
      ```
    </ResponseField>

    <ResponseField name="members" type="[]object" required>
      List of members participating in this thread.

      ```json CEL theme={null}
      members
      ```

      ```json Example theme={null}
      [
      {
      "acked_at": "",
      "group_id": "851981",
      "id": "346292316",
      "status": "THREAD_MEMBER_STATUS_ADDRESSED",
      "thread_id": "346226779",
      "user_id": "6"
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="members.map(x, x.id)" type="[]string" required>
      `ID` Mapped array of: Unique identifier for the thread member.

      ```json CEL theme={null}
      members.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      "346292316"
      ]
      ```
    </ResponseField>

    <ResponseField name="members.map(x, x.thread_id)" type="[]string" required>
      Mapped array of: ID of the thread this member belongs to.

      ```json CEL theme={null}
      members.map(x, x.thread_id)
      ```

      ```json Example theme={null}
      [
      "346226779"
      ]
      ```
    </ResponseField>

    <ResponseField name="members.map(x, x.user_id)" type="[]string" required>
      `ID` Mapped array of: ID of the user, if this member represents a user.

      ```json CEL theme={null}
      members.map(x, x.user_id)
      ```

      ```json Example theme={null}
      [
      "6"
      ]
      ```
    </ResponseField>

    <ResponseField name="members.map(x, x.group_id)" type="[]string" required>
      Mapped array of: ID of the group, if this member represents a group.

      ```json CEL theme={null}
      members.map(x, x.group_id)
      ```

      ```json Example theme={null}
      [
      "851981"
      ]
      ```
    </ResponseField>

    <ResponseField name="status" type="elation.v1.ThreadMemberStatus" required>
      Mapped array of: Current status of the member in this thread.

      ```json CEL theme={null}
      status
      ```

      ```json Example theme={null}
      elation.v1.ThreadMemberStatus.THREAD_MEMBER_STATUS_ADDRESSED
      elation.v1.ThreadMemberStatus.THREAD_MEMBER_STATUS_REQUIRING_ACTION
      ```
    </ResponseField>

    <ResponseField name="members.map(x, x.acked_at)" type="[]timing.v1.Timestamp" required>
      Mapped array of: Timestamp when the member acknowledged the thread, if applicable.

      ```json CEL theme={null}
      members.map(x, x.acked_at)
      ```

      ```json Example theme={null}
      [
      ""
      ]
      ```
    </ResponseField>

    <ResponseField name="messages" type="[]object" required>
      List of messages in this thread.

      ```json CEL theme={null}
      messages
      ```

      ```json Example theme={null}
      [
      {
      "associated_document": {
      "added_to_chart_at": "2014-01-24T18:13:48Z",
      "authoring_practice_id": "65540",
      "created_at": "2014-01-24T18:13:48Z",
      "deleted_at": "",
      "document_timestamp": "2014-01-24T18:59:15Z",
      "document_type": 91,
      "id": "64077889627",
      "last_modified_at": "2016-05-02T18:53:12Z",
      "patient_id": "64072843265",
      "signed_at": "2014-01-24T18:13:48Z",
      "signed_by": "4"
      },
      "body": "Patient should have appointment already booked.",
      "id": "346423390",
      "patient_id": "342753281",
      "practice_id": "655364",
      "sender_id": "6",
      "sent_at": "2021-10-19T19:08:48",
      "thread_id": "346226779"
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="messages.map(x, x.id)" type="[]string" required>
      Mapped array of: Unique identifier for the message.

      ```json CEL theme={null}
      messages.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      "346423390"
      ]
      ```
    </ResponseField>

    <ResponseField name="messages.map(x, x.body)" type="[]string" required>
      Mapped array of: Content of the message. Must not be empty.

      ```json CEL theme={null}
      messages.map(x, x.body)
      ```

      ```json Example theme={null}
      [
      "Patient should have appointment already booked."
      ]
      ```
    </ResponseField>

    <ResponseField name="messages.map(x, x.patient_id)" type="[]string" required>
      `ID` Mapped array of: ID of the patient this message relates to.

      ```json CEL theme={null}
      messages.map(x, x.patient_id)
      ```

      ```json Example theme={null}
      [
      "342753281"
      ]
      ```
    </ResponseField>

    <ResponseField name="messages.map(x, x.practice_id)" type="[]string" required>
      Mapped array of: ID of the practice this message belongs to.

      ```json CEL theme={null}
      messages.map(x, x.practice_id)
      ```

      ```json Example theme={null}
      [
      "655364"
      ]
      ```
    </ResponseField>

    <ResponseField name="messages.map(x, x.thread_id)" type="[]string" required>
      Mapped array of: ID of the thread this message belongs to.

      ```json CEL theme={null}
      messages.map(x, x.thread_id)
      ```

      ```json Example theme={null}
      [
      "346226779"
      ]
      ```
    </ResponseField>

    <ResponseField name="messages.map(x, x.sender_id)" type="[]string" required>
      `ID` Mapped array of: ID of the user who sent this message.

      ```json CEL theme={null}
      messages.map(x, x.sender_id)
      ```

      ```json Example theme={null}
      [
      "6"
      ]
      ```
    </ResponseField>

    <ResponseField name="messages.map(x, x.sent_at)" type="[]timing.v1.Timestamp" required>
      Mapped array of: Timestamp when the message was sent.

      ```json CEL theme={null}
      messages.map(x, x.sent_at)
      ```

      ```json Example theme={null}
      [
      "2021-10-19T19:08:48"
      ]
      ```
    </ResponseField>

    <ResponseField name="messages.map(x, x.associated_document)" type="[]bool" required>
      Mapped array of: Reference to the document this message is associated with, if any.

      ```json CEL theme={null}
      messages.map(x, x.associated_document)
      ```

      ```json Example theme={null}
      [
      {
      "added_to_chart_at": "2014-01-24T18:13:48Z",
      "authoring_practice_id": "65540",
      "created_at": "2014-01-24T18:13:48Z",
      "deleted_at": "",
      "document_timestamp": "2014-01-24T18:59:15Z",
      "document_type": 91,
      "id": "64077889627",
      "last_modified_at": "2016-05-02T18:53:12Z",
      "patient_id": "64072843265",
      "signed_at": "2014-01-24T18:13:48Z",
      "signed_by": "4"
      }
      ]
      ```
    </ResponseField>
  </Expandable>
</ResponseField>
