# Upcoming Appointments

Use the `upcomingAppointments` query to retrieve the list of coming appointments assigned for a user.

### Arguments

| Argument | Type   | Description                                                                                            |
| -------- | ------ | ------------------------------------------------------------------------------------------------------ |
| `first`  | Int    | Retrieves the first results from the list.                                                             |
| `last`   | Int    | Retrieves the last results from the list.                                                              |
| `after`  | String | See [pagination](https://docs.suggestic.com/graphql/start-here/tutorials-and-walkthroughs/pagination). |
| `before` | String | See [pagination](https://docs.suggestic.com/graphql/start-here/tutorials-and-walkthroughs/pagination). |

### Available Fields

<table data-header-hidden><thead><tr><th width="236.33333333333331">Field</th><th width="203">Type</th><th>Description</th></tr></thead><tbody><tr><td>Field</td><td>Type</td><td>Description</td></tr><tr><td><code>id</code></td><td>ID</td><td>A base64-encoded version of the <code>databaseId</code></td></tr><tr><td><code>appointmentCredits</code></td><td>AppointmentCredit</td><td><a href="../../../objects/appointments/appointment-credit">Appointment credit.</a></td></tr><tr><td><code>appointmentType</code></td><td>AppointmentType!</td><td><a href="https://app.gitbook.com/o/-LwqSh0rNboNaGEQruZQ/s/-LwqSnBDpAb6mFZYLsuB/~/changes/1928/objects/appointment/appointment-type">Appointment Type.</a></td></tr><tr><td><code>attendees</code></td><td>string</td><td><a href="https://app.gitbook.com/o/-LwqSh0rNboNaGEQruZQ/s/-LwqSnBDpAb6mFZYLsuB/~/changes/1928/objects/appointment/attendee">Users attending to the appointment.</a></td></tr><tr><td><code>coach</code></td><td>string</td><td>Coaching portal <a href="https://app.gitbook.com/o/-LwqSh0rNboNaGEQruZQ/s/-LwqSnBDpAb6mFZYLsuB/~/changes/1928/objects/appointments/coach">Coach</a>.</td></tr><tr><td><code>contactType</code></td><td>CalendarContactType!</td><td>enum: GOOGLE_MEET, PHONE_CALL, VIDEO_CALL, ZOOM</td></tr><tr><td><code>description</code></td><td>String</td><td>Description of the appointment.</td></tr><tr><td><code>end</code></td><td>DateTime!</td><td>Date and time when the appointment will end. <code>YYYY-MM-DDT hh:mm:ss</code></td></tr><tr><td><code>labTestReports</code></td><td>LabTestReportConnection</td><td>Lab test report assigned to the appointment.</td></tr><tr><td><code>postEventStatus</code></td><td>PostEventStatus</td><td>enum: <em>CANCELED_BY_COACH</em>, <em>CANCELED_BY_MEMBER</em>, <em>COACH_NO_SHOW COMPLETED, MEMBER_NO_SHOW, RESCHEDULED_BY_ADMIN, RESCHEDULED_BY_COACH, RESCHEDULED_BY_MEMBER, SCHEDULED</em></td></tr><tr><td><code>start</code></td><td>DateTime!</td><td>Date and time when the appointment will start. <code>YYYY-MM-DDT hh:mm:ss</code></td></tr><tr><td><code>status</code></td><td>EventStatus!</td><td>enum: CANCELLED, CONFIRMED, TENTATIVE, UNKNOW</td></tr><tr><td><code>title</code></td><td>String!</td><td>Title of the appointment.</td></tr><tr><td><code>zoomSessionName</code></td><td>String</td><td>Zoom session name.</td></tr><tr><td><code>ZoomSessionPassword</code></td><td>String</td><td>Zoom session password.</td></tr></tbody></table>

## Example

{% tabs %}
{% tab title="Request" %}

<pre class="language-graphql"><code class="lang-graphql"><strong>query {upcomingAppointments 
</strong>{
  edges{
    node{
      title
      start
      end
      id
      coach{
        name
      }
    }
  }
}
}
</code></pre>

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "upcomingAppointments": {
      "edges": [
        {
          "node": {
            "title": "Test qa",
            "start": "2024-02-01T19:30:00+00:00",
            "end": "2024-02-01T20:00:00+00:00",
            "id": "QXBwb2ludG1lbnQ6MjA4NDQ=",
            "coach": {
              "name": "Suggestic Admin Coach"
            }
          }
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

## Building Appointment URL

We do not provide the appointment URL as field, instead we build the link directly on the app which can be done by using below link and replacing the fields `zoomSessionName` , `zoomSessionPassword` and `displayName`  with the data gathared from the query `upcomingAppointments` as below:

{% tabs %}
{% tab title="First Tab" %}

```graphql
query {upcomingAppointments 
{
  edges{
    node{
      id
      start
      zoomSessionName
      zoomSessionPassword
      attendees{
        displayName
      }
    }
  }
}
}
```

{% endtab %}

{% tab title="Second Tab" %}

```graphql
{
  "data": {
    "upcomingAppointments": {
      "edges": [
        {
          "node": {
            "id": "QXBwb2ludG1lbnQ6MjcxNDA=",
            "start": "2024-06-06T00:00:00+00:00",
            "zoomSessionName": "QltDAwXugsP0jE16fM0mSM69RMDOlEpwtHaBSuXbIwYg5USSZ1ivbK2NH2L",
            "zoomSessionPassword": "GuH5QrNtlo",
            "attendees": [
              {
                "displayName": "User"
              }
            ]
          }
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

**URL Template:**

```javascript
https://coaching.suggestic.com/calls/join?topic=[zoomSessionName]&password=[zoomSessionPassword]&userName=[user/coach name]
```

**End Result:**

```javascript
https://coaching.suggestic.com/calls/join?topic=QltDAwXugsP0jE16fM0mSM69RMDOlEpwtHaBSuXbIwYg5USSZ1ivbK2NH2L&password=GuH5QrNtlo&userName=User
```
