Go Official Driver

I am building a custom app for integrating our ERP software with Mattermost ahead of deployment to my company. I have gotten messages returning as I expect on mentioned code words. For example order #9999 returns basic details of that order back to the channel that ‘order #9999’ is mentioned in. I want to format this return data as a formatted Message Attachment. I am finding it impossible to understand how to do this. I started with the Go Bot sample project and built upon that. I would appreciate some guidance. Thanks!

Hi @earlgrei! Apologies for the late reply and thank you for reaching out.

Would you have a link to the project you are using (I just want to make sure I’m looking at the right one)?

@amy.blais I was able to get it figured out with the help of @hmhealey and @jwilander over in the pre-release MM server. Code sample is included.

I was using this sample project to get started. https://github.com/mattermost/mattermost-bot-sample-golang

post := &model.Post{
	Message:   "message",
	ChannelId: replyToChannel,
	Props: map[string]interface{}{
		"attachments": []model.SlackAttachment{
			{
				Color:     "#7800FF",
				Pretext:   "Some text here",
				Text:      "This is the text of the attachment. It should appear just above the image",
				ThumbURL:  "https://slack.global.ssl.fastly.net/7bf4/img/services/jenkins-ci_128.png",
				Title:     "A slack attachment",
				TitleLink: "https://www.google.com",
			},
		},
	},
}
1 Like