Skip to content

Instantly share code, notes, and snippets.

Created Nov 9, 2013
What would you like to do?
Idobata General Webhook Client (golang)
package main
import "net/http"
import "net/url"
import "os"
import "fmt"
import "flag"
import "io/ioutil"
func main() {
var webhook_url = os.Getenv("URL")
format := func() string {
f := ""
flag.StringVar(&f, "format", "html", "html or json")
return f
source := func() string {
bytes, err := ioutil.ReadAll(os.Stdin)
if err != nil {
return string(bytes)
// fmt.Println(webhook_url)
// fmt.Println(Format)
_, err := http.PostForm(webhook_url, url.Values{"format": {format}, "source": {source}})
if err != nil {
// fmt.Println(resp.Status)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment