Skip to content

Instantly share code, notes, and snippets.

@xNok
Created April 6, 2021 03:34
Show Gist options
  • Save xNok/3f8e9f1274ab4522958daadc85ea71ae to your computer and use it in GitHub Desktop.
Save xNok/3f8e9f1274ab4522958daadc85ea71ae to your computer and use it in GitHub Desktop.
func GreetingMessage(user string) []slack.Block {
// we need a stuct to hold template arguments
type args struct {
User string
}
tpl := renderTemplate(greetingAssets, "greetingViews/greeting.json", args{User: user})
// we convert the view into a message struct
view := slack.Msg{}
str, _ := ioutil.ReadAll(&tpl)
json.Unmarshal(str, &view)
// We only return the block because of the way the PostEphemeral function works
// we are going to use slack.MsgOptionBlocks in the controller
return view.Blocks.BlockSet
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment