This commit is contained in:
parent
6de086824b
commit
b5c5642bf7
2 changed files with 21 additions and 0 deletions
2
go.mod
2
go.mod
|
@ -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
19
main.go
|
@ -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()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue