Summary
Can’t post a message to a channel using Golang mattermost client
Steps to reproduce
Mattermost 5.9
Create a client
httpClient := &http.Client{
CheckRedirect: redirectPolicyFunc,
}
client := model.NewAPIv4Client(config.serverURL)
client.HttpClient = httpClient
client.AuthToken = config.token
client.AuthType = model.ACCESS_TOKEN_TYPE
user, resp := client.GetMe("")
Try to create post
post.UserId = user.Id
post.ChannelId = config.infoChannelId
post.Message = "Message Text"
posted, resp := client.CreatePost(post)
Got an error
2019/05/05 19:26:06 : Sorry, we could not find the page., There doesn't appear to be an api call for the url='/api/v4/posts'. Typo? are you missing a team_id or user_id as part of the url?
Expected behavior
Expected to post message to channel
Observed behavior
Got an error instead of it