diff --git a/services/tickets/wenichats/service.go b/services/tickets/wenichats/service.go index 253506015..f9f84de25 100644 --- a/services/tickets/wenichats/service.go +++ b/services/tickets/wenichats/service.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "net/http" + "sort" "strconv" "strings" "sync" @@ -168,6 +169,10 @@ func (s *service) Open(session flows.Session, topic *flows.Topic, body string, a msgs = append(msgs, frmsgs...) } + sort.Slice(msgs, func(i, j int) bool { + return msgs[i].CreatedOn().Before(msgs[j].CreatedOn()) + }) + //send history for _, msg := range msgs { var direction string