Git Product home page Git Product logo

witgo's Introduction

witgo

A Golang client for wit.ai - an API which allows developers to "easily create text or voice based bots that humans can chat with on their preferred messaging platform."

Intended to play nicely with twittergo.

Info

Contributing

Pull requests or github issues are welcome. If you send a PR please add yourself to CONTRIBUTORS as well.

Usage

Import the versioned path:

import "github.com/kurrik/witgo/v1/witgo"

Should be close to the Node wit.ai client library.

Construct a handler satisfying the following interface:

type Handler interface {
        Action(session *Session, action string) (response *Session, err error)
        Say(session *Session, msg string) (response *Session, err error)
        Merge(session *Session, entities EntityMap) (response *Session, err error)
        Error(session *Session, msg string)
}

Create a client with your Server Access Token:

client = witgo.NewClient(token)

Create an input reader satisfying the following interface:

type Input interface {
        Run() (requests chan<- SessionID, records <-chan InputRecord)
}

Or use the interactive input reader:

input = witgo.NewInteractiveInput()

Then create a new Witgo object and call process on it:

wg = witgo.NewWitgo(client, handler)
err = wg.Process(input)

Environment flags

Flag Description
HTTP_PROXY Passes API requests through a proxy, useful for debugging. Ex: HTTP_PROXY=http://localhost:8080
TLS_INSECURE Do not use in production! Ignore SSL errors. May help if you're using a proxy and requests are rejected due to certificate errors. Ex: TLS_INSECURE=1

Examples

The examples directory contain directories which demonstrate some of the intended uses of this library:

witgo's People

Contributors

kurrik avatar

Watchers

James Cloos avatar Kaleb Scholes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.