Skip to content

Instantly share code, notes, and snippets.

@kaakaa
Created September 11, 2018 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaakaa/4ea7c44bb7c1e4fdec2e12f60aa97336 to your computer and use it in GitHub Desktop.
Save kaakaa/4ea7c44bb7c1e4fdec2e12f60aa97336 to your computer and use it in GitHub Desktop.
mattermost interactive select menu sample
package main
import (
"log"
"github.com/mattermost/mattermost-server/model"
)
func main() {
c := model.NewAPIv4Client("http://localhost:8065")
c.AuthToken = "PERSONAL_ACCESS_TOKEN"
c.AuthType = model.HEADER_BEARER
if _, err := c.CreatePost(&model.Post{
ChannelId: "CHANNEL_ID",
Message: "test",
Props: model.StringInterface{
"attachments": []*model.SlackAttachment{
{
Text: "text2",
Actions: []*model.PostAction{
{
Integration: &model.PostActionIntegration{
Context: model.StringInterface{
"s": "foo",
"n": 3,
},
URL: "https://localhost:8065",
},
Name: "action",
Type: model.POST_ACTION_TYPE_SELECT,
DataSource: "some_source",
Options: []*model.PostActionOptions{
{Text: "Yes", Value: "y"},
{Text: "No", Value: "n"},
},
},
},
},
},
},
}); err != nil {
log.Fatal(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment