This library allows you to integrate Api.ai natural language processing service with your Go application. For more information see the docs.
We encourage you to follow this official guide to get started in 5 steps before proceeding.
go get github.com/marcossegovia/apiai-go
import (
"fmt"
"github.com/marcossegovia/apiai-go"
)
func main() {
client, err := apiai.NewClient(
&apiai.ClientConfig{
Token: "YOUR-API-AI-TOKEN",
QueryLang: "en", //Default en
SpeechLang: "en-US", //Default en-US
},
)
if err != nil {
fmt.Printf("%v", err)
}
//Set the query string and your current user identifier.
qr, err := client.Query(apiai.Query{Query: []string{"My name is Marcos and I live in Barcelona"}, SessionId: "123454321"})
if err != nil {
fmt.Printf("%v", err)
}
fmt.Printf("%v", qr.Result.Fulfillment.Speech)
}
See CONTRIBUTING