How to get a threads posts in order

Hi,

I am trying to use the golang API for writing a bot. I need to get a thread and all the posts in it in the correct order. I try this:

	thread, _ := client.GetPostThread(postInThreadId, "")
	for _, postId := range thread.Order {
		println(thread.Posts[postId].Message)
	}

It works, as it returns (prints) all the posts in the thread, but:

  1. The order is not correct
  2. The message for which I get the thread is printed twice

Here some examples:

  1. I post a simple message
    “Hello”

Output:

Hello
Hello
  1. I reply to the message
    “How are you?”

Output:

How are you?
Hello
How are you?
  1. I comment:
    “What are you doing?”

Output:

What are you doing?
Hello
What are you doing?
How are you?

I can deal with the double printed message, but how can I find the original order?

Thanks!

I am experiencing the same issue.

@RudolfVonKrugstein did you find a way to make it work?

I know the endpoint returns an “order” item on the response and a dictionary with the “posts” details, but the order of the list isn’t the order the posts were created, at least not in my experiments.