Created
September 5, 2018 04:31
-
-
Save aikyo02/16ace5843f2167a6503d64299dee6485 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package idobata_client | |
import "net/http" | |
import "net/url" | |
import "fmt" | |
const WEBHOOK_URL = "https://idobata.io/hook/custom/1f0794ab-dde4-4255-a750-0d7aa7e12714" | |
func PostByWebhook(message string) { | |
req_body := url.Values{} | |
req_body.Add("source", message) | |
_, err := http.PostForm(WEBHOOK_URL, req_body) | |
if err != nil { | |
fmt.Println(err) | |
} | |
} | |
const BOT_TOKEN = "xxxxxxxx" | |
const END_POINT = "https://api.idobata.io/graphql" | |
func PostByAPI(message string) { | |
req_body := url.Values{} | |
// WIP | |
// req_body.Add("mutation", message) | |
// req_body.Add("mutation", "") | |
req, err := http.NewRequest("POST", END_POINT, bytes.NewBuffer([]byte(req_body))) | |
req.Header.Add("Content-Type", "application/json") | |
req.Header.Add("Authorization", "Bearer " + BOT_TOKEN) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment