Skip to content

Instantly share code, notes, and snippets.



Last active Jun 7, 2018
What would you like to do?
AWS IoT エンタープライズボタンを押したら、slackに投稿する。ver 1
package main
import (
func Post(event IotButtonEvent) (string, error) {
api := slack.New("xxxx-xxxxxxxxx-xxxxxxxxxx")
// send message
params := slack.PostMessageParameters{}
var respChannel, respTimestamp, err = api.PostMessage("XXXXXXXXX", "イラッとしたね!", params)
if err != nil {
fmt.Printf("%s\n", err)
return "error", err
// result
return fmt.Sprintf("%s:%s", respChannel, respTimestamp), nil
func main() {
package main
type IotButtonEvent struct {
DeviceInfo struct {
DeviceID string `json:"deviceId"`
Type string `json:"type"`
RemainingLife float64 `json:"remainingLife"`
Attributes struct {
ProjectName string `json:"projectName"`
ProjectRegion string `json:"projectRegion"`
PlacementName string `json:"placementName"`
DeviceTemplateName string `json:"deviceTemplateName"`
} `json:"attributes"`
} `json:"deviceInfo"`
DeviceEvent struct {
ButtonClicked struct {
ClickType string `json:"clickType"`
ReportedTime int64 `json:"reportedTime"`
} `json:"buttonClicked"`
} `json:"deviceEvent"`
PlacementInfo struct {
ProjectName string `json:"projectName"`
PlacementName string `json:"placementName"`
Attributes struct {
Key1 string `json:"key1"`
} `json:"attributes"`
Devices struct {
LightButton string `json:"lightButton"`
} `json:"devices"`
} `json:"placementInfo"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment