# README
Glip Webhook Client in Go
Installation
$ go get github.com/grokify/go-glip
Usage
- Create a webhook URL for a conversation in Glip
- Use the code below to send a message to the webhook URL
import (
"fmt"
"github.com/grokify/go-glip"
)
func sendMessage() {
// Can instantiate webhook client with full URL or GUID only
url := "https://hooks.glip.com/webhook/00001111-2222-3333-4444-555566667777"
client, err := glipwebhook.NewGlipWebhookClient(url)
if err != nil {
panic("BAD URL")
}
msg := glipwebhook.GlipWebhookMessage{
Icon: "https://raw.githubusercontent.com/grokify/glip-go-webhook/master/glip_gopher_600x600xfff.png",
Activity: "Gopher [Bot]",
Title: "Test Message Title",
Body: "Test Message Body"}
resp, err := client.PostMessage(msg)
respBodyBytes, err := client.SendMessage(msg)
if err == nil {
fmt.Printf("%v\n", string(respBodyBytes))
}
}
Using fasthttp
client
Posts can be made using fasthttp
.
import (
"fmt"
"github.com/grokify/go-glip"
)
func sendMessage() {
// Can instantiate webhook client with full URL or GUID only
url := "https://hooks.glip.com/webhook/00001111-2222-3333-4444-555566667777"
client, err := glipwebhook.NewGlipWebhookClientFast(url)
if err != nil {
panic("BAD URL")
}
msg := glipwebhook.GlipWebhookMessage{
Body: "Test Message Body"}
req, resp, err := client.PostMessageFast(msg)
if err == nil {
fmt.Println(string(resp.Body()))
}
fasthttp.ReleaseRequest(req)
fasthttp.ReleaseResponse(resp)
}
You can reuse the client for different Webhook URLs or GUIDs as follows:
// Webhook URL
res, resp, err := client.PostWebhookFast(url, msg)
// Webhook GUID
res, resp, err := client.PostWebhookGUIDFast(guid, msg)
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
#nosec G101.
#nosec G101.
#nosec G101.
#nosec G101.
No description provided by the author
# Variables
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author