Stuff
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Kekskurse 2022-01-16 13:25:40 +01:00
parent 6de086824b
commit b5c5642bf7
Signed by: kekskurse
GPG key ID: 728ACCB59341E7E4
2 changed files with 21 additions and 0 deletions

2
go.mod
View file

@ -1,3 +1,5 @@
module notfall module notfall
go 1.17 go 1.17
require github.com/sms77io/go-client v0.0.0-20211026080708-90d592e387a5

19
main.go
View file

@ -3,8 +3,10 @@ package main
import ( import (
_ "embed" _ "embed"
"encoding/json" "encoding/json"
"github.com/sms77io/go-client/sms77api"
"html/template" "html/template"
"net/http" "net/http"
"os"
"time" "time"
) )
@ -43,6 +45,23 @@ func main() {
}) })
http.HandleFunc("/activate", func(writer http.ResponseWriter, request *http.Request) { 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 active = true
activeSince = time.Now() activeSince = time.Now()
}) })