Forum Discussion

AishwaryaEA's avatar
9 days ago

Incremental data for attachments in messages and replies

I am trying to get incremental data based on required datetime field for attachments related data in messages and replies. Can someone please help me with this ?

Graphql queries for which I need incremental data is as follows:

query Attachments {
  messages {
    edges {
      node {
        id
        attachments {
          edges {
            node {
              id
              filename
              url
            }
          }
        }
      }
    }
  }
}

Thanks

  • query Attachments {
      messages(constraints: {attachmentsCount: {gt: 0}}) {
        edges {
          node {
            lastPublishTime
          }
        }
      }
    }

    AishwaryaEA not sure if this works
    I don't think attachment has datetime field (maybe I am wrong), but you can use the datetime from the messages / replies maybe?

    • AishwaryaEA's avatar
      AishwaryaEA
      Helper

      peterluThanks for answering. Actually this one will give me all the data which has any no. of attachment but I wanted to have it incrementally only. I was actually able to modify query, based on conversationLastPostTime constraints, but that is also just giving me 25 records at once rather than giving all incremental records. Please let me know if there is any workaround it. My query:

      query Attachments {
        messages(
          constraints: {conversationLastPostTime: {gte: "2024-06-01T01:47:41.349-08:00", lte: "2024-10-29T13:23:23.074-07:00"}, depth: {eq: 0}}
          last: 1000
        ) {
          edges {
            node {
              id
              attachments {
                edges {
                  node {
                    id
                    filename
                    url
                  }
                }
              }
            }
          }
        }
      }