DialogFlow (API.AI) Golang SDK

DialogFlow (API.AI) Golang SDK

DialogFlow (formerly API.AI) gives users new ways to interact with your bot by building engaging voice and text-based conversational interfaces powered by AI.

DialogFlow offers many SDKs in different programming languages:



But unfortunately, there’s no SDK for Golang



But dont be sad, I made an SDK to integrate DialogFlow with Golang:



This library allows integrating agents from the DialogFlow natural language processing service with your Golang application.

Issue the following command to install the library:

1
go get github.com/mlabouardy/dialogflow-go-client

The example below, display list of entities:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package main

import (
"fmt"
"github.com/mlabouardy/dialogflow-go-client"
"github.com/mlabouardy/dialogflow-go-client/models"
"log"
)

func main() {
err, client := NewDialogFlowClient(Options{
AccessToken: "<DIALOGFLOW TOKEN GOES HERE>",
})
if err != nil {
log.Fatal(err)
}

entities, err := client.EntitiesFindAllRequest()
if err != nil {
log.Fatal(err)
}
for _, entity := range entities {
fmt.Println(entity.Name)
}
}

Note: for more details about the available methods, check the project GitHub repository.

For a real world example on how to use this library, check my previous tutorial, on how to create a Messenger Bot in Golang to show list of movies playing in cinema, and tv shows airing on TV:



Drop your comments, feedback, or suggestions below — or connect with me directly on Twitter @mlabouardy.

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×