Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Fix email which is sent to users on failed webhook

Acho Arnold23cfd4b5d843
diff --git a/android/build.gradle b/android/build.gradle
index c910f1b2..aa9b130f 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -17,8 +17,8 @@ buildscript {
}
plugins {
- id 'com.android.application' version '8.1.1' apply false
- id 'com.android.library' version '8.1.1' apply false
+ id 'com.android.application' version '8.1.2' apply false
+ id 'com.android.library' version '8.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}
diff --git a/api/pkg/emails/factory.go b/api/pkg/emails/factory.go
index 11d61de8..4c7f1cf7 100644
--- a/api/pkg/emails/factory.go
+++ b/api/pkg/emails/factory.go
@@ -2,6 +2,7 @@ package emails
import (
"fmt"
+ "net/http"
"github.com/nyaruka/phonenumbers"
)
@@ -16,7 +17,7 @@ func (factory *factory) formatPhoneNumber(number string) string {
func (factory *factory) formatHTTPResponseCode(code *int) string {
responseCode := "-"
if code != nil {
- responseCode = fmt.Sprintf("%d", *code)
+ responseCode = fmt.Sprintf("%d - %s", *code, http.StatusText(*code))
}
return responseCode
}
diff --git a/api/pkg/emails/hermes_user_email_factory.go b/api/pkg/emails/hermes_user_email_factory.go
index 6a3c334a..12ce1402 100644
--- a/api/pkg/emails/hermes_user_email_factory.go
+++ b/api/pkg/emails/hermes_user_email_factory.go
@@ -157,7 +157,7 @@ func (factory *hermesUserEmailFactory) PhoneDead(user *entities.User, lastHeartb
return &Email{
ToEmail: user.Email,
- Subject: fmt.Sprintf("⚠️ No heartbeat from android phone [%s]", owner),
+ Subject: fmt.Sprintf("⚠️ No heartbeat from android phone [%s]", factory.formatPhoneNumber(owner)),
HTML: html,
Text: text,
}, nil
diff --git a/api/pkg/services/email_notification_service.go b/api/pkg/services/email_notification_service.go
index 6be73f75..0a7bcaff 100644
--- a/api/pkg/services/email_notification_service.go
+++ b/api/pkg/services/email_notification_service.go
@@ -125,7 +125,7 @@ func (service *EmailNotificationService) NotifyWebhookSendFailed(ctx context.Con
ctx, span, ctxLogger := service.tracer.StartWithLogger(ctx, service.logger)
defer span.End()
- if !service.canSendEmail(ctx, payload.EventType, payload.Owner) {
+ if !service.canSendEmail(ctx, events.EventTypeWebhookSendFailed, payload.Owner) {
ctxLogger.Info(fmt.Sprintf("[%s] email already sent to user [%s] with owner [%s]", events.EventTypeWebhookSendFailed, payload.UserID, payload.Owner))
return nil
}
@@ -158,7 +158,7 @@ func (service *EmailNotificationService) NotifyDiscordSendFailed(ctx context.Con
ctx, span, ctxLogger := service.tracer.StartWithLogger(ctx, service.logger)
defer span.End()
- if !service.canSendEmail(ctx, payload.EventType, payload.Owner) {
+ if !service.canSendEmail(ctx, events.EventTypeDiscordSendFailed, payload.Owner) {
ctxLogger.Info(fmt.Sprintf("[%s] email already sent to user [%s] with owner [%s]", events.EventTypeWebhookSendFailed, payload.UserID, payload.Owner))
return nil
}