How to insert the reply to Conversation thru API?

I need to use the API to create a ‘reply’ within a conversation reply. How can I do this? How do I obtain the Conversation ID to reply to it if there are multiple conversation chats?

Thank you

Hello there @ryanhaha and welcome to the community!

I hope you like it here :muscle:

You can use a query like this one to get data about your item’s updates and replies to the updates:

{
  items(ids: 1234567890) {
    updates {
      text_body
      id
      replies {
        text_body
        id
      }
    }
  }
}

Then you can create an update for an item with a query like this one:

mutation {
  create_update(item_id: 2233445566, body: "Some text") {
    id
  }
}

And if you want to create a reply to an update, you will have to use the parent_id as explained here.

You can not create a reply to a reply. Only replies to updates. You can create multiple replies in the same update.

I hope that helps!

Cheers,
Matias

Hi Matias,

Thank you for your reply. I have attached a picture as a sample. So, can this be achieved using the method you mentioned earlier? like pass in the parent_id?

mutation {
create_update(item_id: 2233445566, body: “Some text”) {
id
}
}

Hello again @ryanhaha,

Exactly! For the update (the image on the left), you would use the item_id.

For the reply to the update (the image on the right) you would use the parent_id (the ID of the update).

Cheers,
Matias

Hi Matias,

Thank you… i managed to use API to add into reply.
but now i want to add the “more information” into table instead of just a string. Is it possible thru API?
please refer the image below:

Hello again @ryanhaha,

You can add HTML as the body of an update:

mutation {
  create_update (item_id: 1234567890, body: "<table><tr><td>Emil</td><td>Tobias</td><td>Linus</td></tr></table>") {
    id
  }
}

But that can not be used for a body of a reply.

Cheers,
Matias