Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting of log type of channel logs and add additional types #605

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions channel_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ const (
ChannelLogTypeMsgStatus ChannelLogType = "msg_status"
ChannelLogTypeMsgReceive ChannelLogType = "msg_receive"
ChannelLogTypeEventReceive ChannelLogType = "event_receive"
ChannelLogTypeMultiReceive ChannelLogType = "multi_receive"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when a payload can contain a mixture of things

ChannelLogTypeAttachmentFetch ChannelLogType = "attachment_fetch"
ChannelLogTypeTokenRefresh ChannelLogType = "token_refresh"
ChannelLogTypePageSubscribe ChannelLogType = "page_subscribe"
ChannelLogTypeWebhookVerify ChannelLogType = "webhook_verify"
)

type ChannelError struct {
Expand Down Expand Up @@ -110,8 +112,8 @@ type ChannelLog struct {

// NewChannelLogForIncoming creates a new channel log for an incoming request, the type of which won't be known
// until the handler completes.
func NewChannelLogForIncoming(ch Channel, r *httpx.Recorder, redactVals []string) *ChannelLog {
return newChannelLog(ChannelLogTypeUnknown, ch, r, NilMsgID, redactVals)
func NewChannelLogForIncoming(logType ChannelLogType, ch Channel, r *httpx.Recorder, redactVals []string) *ChannelLog {
return newChannelLog(logType, ch, r, NilMsgID, redactVals)
}

// NewChannelLogForSend creates a new channel log for a message send
Expand Down
8 changes: 4 additions & 4 deletions handlers/africastalking/africastalking.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ type moForm struct {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "callback", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "delivery", h.receiveStatus)
s.AddHandlerRoute(h, http.MethodPost, "status", h.receiveStatus)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "callback", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "delivery", courier.ChannelLogTypeMsgStatus, h.receiveStatus)
s.AddHandlerRoute(h, http.MethodPost, "status", courier.ChannelLogTypeMsgStatus, h.receiveStatus)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion handlers/arabiacell/arabiacell.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newHandler() courier.ChannelHandler {
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
receiveHandler := handlers.NewTelReceiveHandler(h, "M", "B")
s.AddHandlerRoute(h, http.MethodPost, "receive", receiveHandler)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, receiveHandler)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/bandwidth/bandwidth.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "status", h.statusMessage)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "status", courier.ChannelLogTypeMsgStatus, h.statusMessage)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/blackmyna/blackmyna.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func init() {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodGet, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodGet, "status", h.StatusMessage)
s.AddHandlerRoute(h, http.MethodGet, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodGet, "status", courier.ChannelLogTypeMsgStatus, h.StatusMessage)
return nil
}

Expand Down
6 changes: 5 additions & 1 deletion handlers/bongolive/bongolive.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func init() {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeUnknown, h.receiveMessage)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for routes where we can't know until we parse the payload.. it's set manually with SetType in the method

return nil
}

Expand Down Expand Up @@ -73,6 +73,8 @@ func (h *handler) receiveMessage(ctx context.Context, channel courier.Channel, w
}

if form.MsgType == 5 {
clog.SetType(courier.ChannelLogTypeMsgStatus)

if err != nil {
return nil, handlers.WriteAndLogRequestError(ctx, h, channel, w, r, err)
}
Expand All @@ -87,6 +89,8 @@ func (h *handler) receiveMessage(ctx context.Context, channel courier.Channel, w
return handlers.WriteMsgStatusAndResponse(ctx, h, channel, status, w, r)
}

clog.SetType(courier.ChannelLogTypeMsgReceive)

// create our URN
urn, err := handlers.StrictTelForCountry(form.From, channel.Country())
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions handlers/burstsms/burstsms.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ func newHandler() courier.ChannelHandler {
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
receiveHandler := handlers.NewTelReceiveHandler(h, "mobile", "response")
s.AddHandlerRoute(h, http.MethodGet, "receive", receiveHandler)
s.AddHandlerRoute(h, http.MethodGet, "receive", courier.ChannelLogTypeMsgReceive, receiveHandler)

statusHandler := handlers.NewExternalIDStatusHandler(h, statusMap, "message_id", "status")
s.AddHandlerRoute(h, http.MethodGet, "status", statusHandler)
s.AddHandlerRoute(h, http.MethodGet, "status", courier.ChannelLogTypeMsgStatus, statusHandler)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/clickatell/clickatell.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "status", handlers.JSONPayload(h, h.receiveStatus))
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "status", courier.ChannelLogTypeMsgStatus, handlers.JSONPayload(h, h.receiveStatus))
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/clickmobile/clickmobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func newHandler() courier.ChannelHandler {

func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodGet, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodGet, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgStatus, h.receiveMessage)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion handlers/clicksend/clicksend.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", handlers.NewTelReceiveHandler(h, "from", "body"))
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, handlers.NewTelReceiveHandler(h, "from", "body"))
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/dart/dart.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func init() {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodGet, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodGet, "delivered", h.receiveStatus)
s.AddHandlerRoute(h, http.MethodGet, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodGet, "delivered", courier.ChannelLogTypeMsgStatus, h.receiveStatus)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion handlers/dialog360/dialog360.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func newWAHandler(channelType courier.ChannelType, name string) courier.ChannelH
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", handlers.JSONPayload(h, h.receiveEvent))
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMultiReceive, handlers.JSONPayload(h, h.receiveEvent))
return nil
}

Expand Down
8 changes: 4 additions & 4 deletions handlers/discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)

sentHandler := h.buildStatusHandler("sent")
s.AddHandlerRoute(h, http.MethodPost, "sent", sentHandler)
s.AddHandlerRoute(h, http.MethodPost, "sent", courier.ChannelLogTypeMsgStatus, sentHandler)

deliveredHandler := h.buildStatusHandler("delivered")
s.AddHandlerRoute(h, http.MethodPost, "delivered", deliveredHandler)
s.AddHandlerRoute(h, http.MethodPost, "delivered", courier.ChannelLogTypeMsgStatus, deliveredHandler)

failedHandler := h.buildStatusHandler("failed")
s.AddHandlerRoute(h, http.MethodPost, "failed", failedHandler)
s.AddHandlerRoute(h, http.MethodPost, "failed", courier.ChannelLogTypeMsgStatus, failedHandler)

return nil
}
Expand Down
4 changes: 2 additions & 2 deletions handlers/dmark/dmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "status", h.receiveStatus)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "status", courier.ChannelLogTypeMsgStatus, h.receiveStatus)
return nil
}

Expand Down
20 changes: 10 additions & 10 deletions handlers/external/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,23 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodGet, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodGet, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)

sentHandler := h.buildStatusHandler("sent")
s.AddHandlerRoute(h, http.MethodGet, "sent", sentHandler)
s.AddHandlerRoute(h, http.MethodPost, "sent", sentHandler)
s.AddHandlerRoute(h, http.MethodGet, "sent", courier.ChannelLogTypeMsgStatus, sentHandler)
s.AddHandlerRoute(h, http.MethodPost, "sent", courier.ChannelLogTypeMsgStatus, sentHandler)

deliveredHandler := h.buildStatusHandler("delivered")
s.AddHandlerRoute(h, http.MethodGet, "delivered", deliveredHandler)
s.AddHandlerRoute(h, http.MethodPost, "delivered", deliveredHandler)
s.AddHandlerRoute(h, http.MethodGet, "delivered", courier.ChannelLogTypeMsgStatus, deliveredHandler)
s.AddHandlerRoute(h, http.MethodPost, "delivered", courier.ChannelLogTypeMsgStatus, deliveredHandler)

failedHandler := h.buildStatusHandler("failed")
s.AddHandlerRoute(h, http.MethodGet, "failed", failedHandler)
s.AddHandlerRoute(h, http.MethodPost, "failed", failedHandler)
s.AddHandlerRoute(h, http.MethodGet, "failed", courier.ChannelLogTypeMsgStatus, failedHandler)
s.AddHandlerRoute(h, http.MethodPost, "failed", courier.ChannelLogTypeMsgStatus, failedHandler)

s.AddHandlerRoute(h, http.MethodPost, "stopped", h.receiveStopContact)
s.AddHandlerRoute(h, http.MethodGet, "stopped", h.receiveStopContact)
s.AddHandlerRoute(h, http.MethodPost, "stopped", courier.ChannelLogTypeEventReceive, h.receiveStopContact)
s.AddHandlerRoute(h, http.MethodGet, "stopped", courier.ChannelLogTypeEventReceive, h.receiveStopContact)

return nil
}
Expand Down
8 changes: 4 additions & 4 deletions handlers/facebook/facebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", handlers.JSONPayload(h, h.receiveEvent))
s.AddHandlerRoute(h, http.MethodGet, "receive", h.receiveVerify)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMultiReceive, handlers.JSONPayload(h, h.receiveEvents))
s.AddHandlerRoute(h, http.MethodGet, "receive", courier.ChannelLogTypeWebhookVerify, h.receiveVerify)
return nil
}

Expand Down Expand Up @@ -213,8 +213,8 @@ type moPayload struct {
} `json:"entry"`
}

// receiveEvent is our HTTP handler function for incoming messages and status updates
func (h *handler) receiveEvent(ctx context.Context, channel courier.Channel, w http.ResponseWriter, r *http.Request, payload *moPayload, clog *courier.ChannelLog) ([]courier.Event, error) {
// receiveEvents is our HTTP handler function for incoming messages and status updates
func (h *handler) receiveEvents(ctx context.Context, channel courier.Channel, w http.ResponseWriter, r *http.Request, payload *moPayload, clog *courier.ChannelLog) ([]courier.Event, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed for clarity

// not a page object? ignore
if payload.Object != "page" {
return nil, handlers.WriteAndLogRequestIgnored(ctx, h, channel, w, r, "ignoring non-page request")
Expand Down
8 changes: 4 additions & 4 deletions handlers/facebookapp/facebookapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ type handler struct {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodGet, "receive", h.receiveVerify)
s.AddHandlerRoute(h, http.MethodPost, "receive", handlers.JSONPayload(h, h.receiveEvent))
s.AddHandlerRoute(h, http.MethodGet, "receive", courier.ChannelLogTypeWebhookVerify, h.receiveVerify)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMultiReceive, handlers.JSONPayload(h, h.receiveEvents))
return nil
}

Expand Down Expand Up @@ -371,8 +371,8 @@ func resolveMediaURL(mediaID string, token string, clog *courier.ChannelLog) (st
return mediaURL, err
}

// receiveEvent is our HTTP handler function for incoming messages and status updates
func (h *handler) receiveEvent(ctx context.Context, channel courier.Channel, w http.ResponseWriter, r *http.Request, payload *moPayload, clog *courier.ChannelLog) ([]courier.Event, error) {
// receiveEvents is our HTTP handler function for incoming messages and status updates
func (h *handler) receiveEvents(ctx context.Context, channel courier.Channel, w http.ResponseWriter, r *http.Request, payload *moPayload, clog *courier.ChannelLog) ([]courier.Event, error) {
err := h.validateSignature(r)
if err != nil {
return nil, handlers.WriteAndLogRequestError(ctx, h, channel, w, r, err)
Expand Down
4 changes: 2 additions & 2 deletions handlers/firebase/firebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func newHandler() courier.ChannelHandler {

func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "register", h.registerContact)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "register", courier.ChannelLogTypeEventReceive, h.registerContact)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion handlers/freshchat/freshchat.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func newHandler(channelType courier.ChannelType, name string, validateSignatures
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, handlers.JSONPayload(h, h.receiveMessage))
return nil
}
func (h *handler) receiveMessage(ctx context.Context, channel courier.Channel, w http.ResponseWriter, r *http.Request, payload *moPayload, clog *courier.ChannelLog) ([]courier.Event, error) {
Expand Down
2 changes: 1 addition & 1 deletion handlers/globe/globe.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, handlers.JSONPayload(h, h.receiveMessage))
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/highconnection/highconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodGet, "status", h.receiveStatus)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodGet, "status", courier.ChannelLogTypeMsgStatus, h.receiveStatus)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion handlers/hormuud/hormuud.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion handlers/i2sms/i2sms.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receive)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, h.receive)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/infobip/infobip.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "delivered", handlers.JSONPayload(h, h.statusMessage))
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "delivered", courier.ChannelLogTypeMsgStatus, handlers.JSONPayload(h, h.statusMessage))
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/jasmin/jasmin.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "status", h.receiveStatus)
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeMsgReceive, h.receiveMessage)
s.AddHandlerRoute(h, http.MethodPost, "status", courier.ChannelLogTypeMsgStatus, h.receiveStatus)
return nil
}

Expand Down
8 changes: 4 additions & 4 deletions handlers/jiochat/jiochat.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodGet, "", h.VerifyURL)
s.AddHandlerRoute(h, http.MethodPost, "rcv/msg/message", handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "rcv/event/menu", handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "rcv/event/follow", handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodGet, "", courier.ChannelLogTypeWebhookVerify, h.VerifyURL)
s.AddHandlerRoute(h, http.MethodPost, "rcv/msg/message", courier.ChannelLogTypeMsgReceive, handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "rcv/event/menu", courier.ChannelLogTypeEventReceive, handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "rcv/event/follow", courier.ChannelLogTypeEventReceive, handlers.JSONPayload(h, h.receiveMessage))
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/junebug/junebug.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func newHandler() courier.ChannelHandler {
// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddHandlerRoute(h, http.MethodPost, "event", handlers.JSONPayload(h, h.receiveEvent))
s.AddHandlerRoute(h, http.MethodPost, "inbound", handlers.JSONPayload(h, h.receiveMessage))
s.AddHandlerRoute(h, http.MethodPost, "event", courier.ChannelLogTypeEventReceive, handlers.JSONPayload(h, h.receiveEvent))
s.AddHandlerRoute(h, http.MethodPost, "inbound", courier.ChannelLogTypeMsgReceive, handlers.JSONPayload(h, h.receiveMessage))
return nil
}

Expand Down
Loading