Skip to content

RaMin0/got

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Got

Guide

Facebook Bots

Example

package main

import (
	"fmt"
	"log"
	"net/http"
	"os"

	"github.com/ramin0/got"
)

func main() {
	http.Handle("/messenger/", got.New(&got.BotData{
		BaseURL: "https://mybot.com/messenger",
		Page: &got.BotPage{
			ID:          "...",
			AccessToken: "...",
			VerifyToken: "...",
		},
	}, func(bot *got.BotData) {
		bot.StartBlock(func(b *got.BotBlock) {
			b.Component(&got.PluginFacebookProfile{})
			b.Component(&got.ComponentText{
				Text: "Hello, %{fb:first_name}!",
			})
		})
	}).Handler())

	port := os.Getenv("PORT")
	if port == "" {
		port = "3000"
	}
	log.Printf("Listening on port %s...", port)
	log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
}

About

Yet another bot-building framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages