From a98243c1948e1cea068ca5eba679f074b5cd572a Mon Sep 17 00:00:00 2001 From: itzaname Date: Sun, 8 Jan 2017 01:35:08 -0500 Subject: [PATCH] Final update for 400 bad request --- message.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/message.go b/message.go index ac73d31..56b02a2 100644 --- a/message.go +++ b/message.go @@ -109,8 +109,17 @@ func (s *Session) ArchiveMessages(ids []string) error { return fmt.Errorf("ID list was empty") } - payload := map[string][]string{ - "messageIds": ids, + var newList []int + for i := 0; i < len(ids); i++ { + idString, err := strconv.Atoi(ids[i]) + if err != nil { + return err + } + newList = append(newList, idString) + } + + payload := map[string][]int{ + "messageIds": newList, } data, err := json.Marshal(&payload)