Send and receive SMS messages using your Android phone programmatically via a simple HTTP API
increase the limit of rwebhooks
Acho Arnold36107628914b
diff --git a/api/pkg/handlers/webhook_handler.go b/api/pkg/handlers/webhook_handler.goindex 7557d85e..41200856 100644--- a/api/pkg/handlers/webhook_handler.go+++ b/api/pkg/handlers/webhook_handler.go@@ -160,15 +160,15 @@ func (h *WebhookHandler) Store(c *fiber.Ctx) error {return h.responseUnprocessableEntity(c, errors, "validation errors while storing webhook")}- webhooks, err := h.service.Index(ctx, h.userIDFomContext(c), repositories.IndexParams{Skip: 0, Limit: 3})+ webhooks, err := h.service.Index(ctx, h.userIDFomContext(c), repositories.IndexParams{Skip: 0, Limit: 10})if err != nil {ctxLogger.Error(stacktrace.Propagate(err, fmt.Sprintf("cannot index webhooks for user [%s]", h.userIDFomContext(c))))- return h.responsePaymentRequired(c, "You can't create more than 1 webhook contact us to upgrade your account.")+ return h.responseInternalServerError(c)}- if len(webhooks) > 1 {- ctxLogger.Warn(stacktrace.NewError(fmt.Sprintf("user with ID [%s] wants to create more than 2 webhooks", h.userIDFomContext(c))))- return h.responsePaymentRequired(c, "You can't create more than 2 webhooks contact us to upgrade your account.")+ if len(webhooks) == 10 {+ ctxLogger.Warn(stacktrace.NewError(fmt.Sprintf("user with ID [%s] wants to create more than 5 webhooks", h.userIDFomContext(c))))+ return h.responsePaymentRequired(c, "You can't create more than 10 webhooks contact us to upgrade to our enterprise plan.")}webhook, err := h.service.Store(ctx, request.ToStoreParams(h.userFromContext(c)))diff --git a/api/pkg/services/webhook_service.go b/api/pkg/services/webhook_service.goindex 7f065a16..0cd7a741 100644--- a/api/pkg/services/webhook_service.go+++ b/api/pkg/services/webhook_service.go@@ -67,7 +67,7 @@ func (service *WebhookService) Index(ctx context.Context, userID entities.UserIDreturn nil, service.tracer.WrapErrorSpan(span, stacktrace.Propagate(err, msg))}- ctxLogger.Info(fmt.Sprintf("fetched [%d] messages with prams [%+#v]", len(webhooks), params))+ ctxLogger.Info(fmt.Sprintf("fetched [%d] webhooks with prams [%+#v]", len(webhooks), params))return webhooks, nil}@@ -124,7 +124,7 @@ func (service *WebhookService) Store(ctx context.Context, params *WebhookStorePareturn nil, service.tracer.WrapErrorSpan(span, stacktrace.Propagate(err, msg))}- ctxLogger.Info(fmt.Sprintf("webhook saved with id [%s] in the [%T]", webhook.ID, service.repository))+ ctxLogger.Info(fmt.Sprintf("webhook saved with id [%s] for user [%s] in the [%T]", webhook.ID, webhook.UserID, service.repository))return webhook, nil}