diff --git a/main.go b/main.go
index 80556d900ebfa75515efba3af05458abc066ded9..629feeb97f45d68bd01ef8a65d591500dad1214f 100644
--- a/main.go
+++ b/main.go
@@ -8,6 +8,7 @@ import (
 	"html/template"
 	"math/rand/v2"
 	"net/http"
+	"net/url"
 	"os"
 	"strings"
 )
@@ -15,7 +16,11 @@ import (
 func main() {
 	var err error
 
-	bot := NewMatrixBot()
+	pushUrl, err := url.Parse(os.Getenv("BOT_PUSHURL"))
+	if err != nil {
+		panic(err)
+	}
+	bot := NewMatrixBot(pushUrl)
 
 	// !8ball handler
 	bot.HandleFunc("!8ball", func(bot *MatrixBot, notification api.Notification) error {
@@ -112,7 +117,7 @@ func main() {
 	if err != nil {
 		panic(err)
 	}
-	err = bot.RegisterPusher(os.Getenv("BOT_PUSHURL"))
+	err = bot.RegisterPusher()
 	if err != nil {
 		panic(err)
 	}
diff --git a/matrixbot.go b/matrixbot.go
index ede760a065c28c64ca8804d2a6d08a8ece988c98..6254142f588c7408e1a411842136cafefa6fca6e 100644
--- a/matrixbot.go
+++ b/matrixbot.go
@@ -6,18 +6,21 @@ import (
 	"io"
 	"log"
 	"net/http"
+	"net/url"
 	"strings"
 	"time"
 )
 
 type MatrixBot struct {
 	token    *api.Token
+	pushUrl  *url.URL
 	handlers map[string]func(bot *MatrixBot, notification api.Notification) error
 }
 
-func NewMatrixBot() *MatrixBot {
+func NewMatrixBot(pushUrl *url.URL) *MatrixBot {
 	return &MatrixBot{
 		token:    nil,
+		pushUrl:  pushUrl,
 		handlers: make(map[string]func(bot *MatrixBot, notification api.Notification) error),
 	}
 }
@@ -62,8 +65,8 @@ func (bot *MatrixBot) RefreshTask() {
 	}
 }
 
-func (bot *MatrixBot) RegisterPusher(url string) error {
-	return api.SetPusher(*bot.token, url)
+func (bot *MatrixBot) RegisterPusher() error {
+	return api.SetPusher(*bot.token, bot.pushUrl.String())
 }
 
 func (bot *MatrixBot) HandleFunc(command string, handler func(bot *MatrixBot, notification api.Notification) error) {
@@ -75,7 +78,7 @@ func (bot *MatrixBot) Serve(endpoint string) {
 		writer.WriteHeader(200)
 		_, _ = io.WriteString(writer, "OK\n")
 	})
-	http.HandleFunc("/_matrix/push/v1/notify", func(writer http.ResponseWriter, request *http.Request) {
+	http.HandleFunc(bot.pushUrl.RequestURI(), func(writer http.ResponseWriter, request *http.Request) {
 		log.Println("Received push notification")
 		notification, err := api.ParseNotification(request.Body)
 		if err != nil {