DEPRECATED

godoc

About

Package action is a golang client for dialog flow requests and responses through Google Actions.

Usage

dialogflow.HandleAction("foo", func(w http.ResponseWriter, r *http.Request, req *dialogflow.Request) {
    param1 := req.QueryResult.Parameters.Get("param1")
    param2 := req.QueryResult.Parameters.Get("param2")
    text := fmt.Sprintf("param1: %v\nparam2: %v", param1, param2)
    show, err := google.NewDisplayText(text)
    if err != nil {
        log.Println(errors.WithStack(err))
    }
    resp := dialogflow.Google(true, []string{"foo"}, google.Simple(show, text))
    json.NewEncoder(w).Encode(resp)
})

http.HandleFunc("/action", dialogflow.Dispatch)