Threads, Group Chats, and DMs

In Glue, conversations occur inside threads, group chats or DMs. The functionality and appearance of these are very similar, and in the API, they are all represented by a Thread.

To distinguish the 3 in the API, look at the isPeristentChat and recipients fields.

DMs

DMs will have isPeristentChat: true and the recipients field will contain exactly 2 users.

GraphQL Response Sample

{
  "data": {
    "thread": {
      "id": "thr_2PtTG7GFSgcgwfpeDOBGEQtyB24",
      "isPeristentChat": true,
      "recipients": {
        "edges": [
          {
            "node": {
              "id": "usr_1h3c43PfmSQpPb0CXwRJUYs0ker",
              "name": "Alice Johnson"
            }
          },
          {
            "node": {
              "id": "usr_2mHVPy5LlHYPs2zHcwm56M85J3h",
              "name": "Bob Smith"
            }
          }
        ]
      }
    }
  }
}

Looking Up a DM's Thread ID

To find the thread ID for a DM with a specific user, you can query for a UserEdge and access its persistentChatEdge. The UserEdge represents the relationship between the current user and another user, and contains a persistentChatEdge field that points to the DM thread.

Note: The UserEdge ID follows the pattern {otherUserID}-{currentUserID}. In this example, usr_2mHVPy5LlHYPs2zHcwm56M85J3h-usr_1h3c43PfmSQpPb0CXwRJUYs0ker represents the edge from Alice (current user) to Bob (other user). One of the 2 user IDs must be the user associated with the access token. You cannot access DMs involving other users.

GraphQL Query Example

Variables

Response Sample

Group Chats

Group Chats will have isPeristentChat: true and the recipients field will contain exactly 1 group.

GraphQL Response Sample

Threads

Threads will have isPeristentChat: false. The recipients field could contain any combination of users and groups.

GraphQL Response Sample

Last updated

Was this helpful?