From b5c5642bf716c73a65d5d06097fbdb26fdacec58 Mon Sep 17 00:00:00 2001 From: kekskurse Date: Sun, 16 Jan 2022 13:25:40 +0100 Subject: [PATCH] Stuff --- go.mod | 2 ++ main.go | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/go.mod b/go.mod index 24b8db2..b2ee3bb 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module notfall go 1.17 + +require github.com/sms77io/go-client v0.0.0-20211026080708-90d592e387a5 diff --git a/main.go b/main.go index 81324cc..77df6dc 100644 --- a/main.go +++ b/main.go @@ -3,8 +3,10 @@ package main import ( _ "embed" "encoding/json" + "github.com/sms77io/go-client/sms77api" "html/template" "net/http" + "os" "time" ) @@ -43,6 +45,23 @@ func main() { }) http.HandleFunc("/activate", func(writer http.ResponseWriter, request *http.Request) { + if active == true { + return + } + var klient = sms77api.New(sms77api.Options{ + ApiKey: os.Getenv("sms77key"), + }) + + sms := sms77api.SmsBaseParams{ + Text: "Something", + To: "004917655424258", + From: "Notfall-Portal" + } + klient.Sms.Text(sms77api.SmsTextParams{ + SmsBaseParams: sms, + Details: false, + ReturnMessageId: false, + }) active = true activeSince = time.Now() })