Documentation
¶
Overview ¶
Package apiai provides an easy way to handle webhooks coming from api.ai, as described in the documentation: https://api.ai/docs/fulfillment
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides an easy way to route and handle requests by intent.
func (*Handler) Register ¶
func (h *Handler) Register(intent string, handler IntentHandler)
Register registers the handler for a given intent.
type IntentHandler ¶
IntentHandler handles an intent.
type Request ¶
type Request struct { Lang string `json:"lang"` Status struct { ErrorType string `json:"errorType"` Code int `json:"code"` } `json:"status"` Timestamp time.Time `json:"timestamp"` SessionID string `json:"sessionId"` Result struct { Parameters map[string]string `json:"parameters"` Contexts []struct{} `json:"contexts"` // TODO ResolvedQuery string `json:"resolvedQuery"` Source string `json:"source"` Score float64 `json:"score"` Speech string `json:"speech"` Fulfillment struct { Messages []struct { } `json:"messages"` Speech string `json:"speech"` } `json:"fulfillment"` ActionIncomplete bool `json:"actionIncomplete"` Action string `json:"action"` Metadata struct { IntentID string `json:"intentId"` WebhookForSlotFillingUsed bool `json:"webhookForSlotFillingUsed,string"` IntentName string `json:"intentName"` WebhookUsed bool `json:"webhookUsed,string"` } `json:"metadata"` } `json:"result"` ID string `json:"id"` OriginalRequest struct { Source string `json:"source"` Data map[string]interface{} `json:"data"` // TODO } `json:"originalRequest"` }
A Request contains all of the information to an intent invocation.