Skip to content

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

Do not send sent events to the server for multipart messages with invalid ID

Acho Arnoldb7510517a6e9
diff --git a/android/app/src/main/java/com/httpsms/SentReceiver.kt b/android/app/src/main/java/com/httpsms/SentReceiver.kt
index 2d4d2b6f..878526bf 100644
--- a/android/app/src/main/java/com/httpsms/SentReceiver.kt
+++ b/android/app/src/main/java/com/httpsms/SentReceiver.kt
@@ -31,6 +31,10 @@ internal class SentReceiver : BroadcastReceiver() {
}
private fun handleMessageSent(context: Context, messageId: String?) {
+ if (!Receiver.isValid(context, messageId)) {
+ return
+ }
+
val constraints = Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.build()
diff --git a/api/cmd/experiments/main.go b/api/cmd/experiments/main.go
index 897c5c4c..c4e00285 100644
--- a/api/cmd/experiments/main.go
+++ b/api/cmd/experiments/main.go
@@ -27,6 +27,7 @@ func main() {
logger := container.Logger()
logger.Info("Starting experiments")
+ loadTest()
}
func text3CX() {
@@ -51,7 +52,6 @@ func loadTest() {
wg.Add(1)
go func(count int) {
sendSMS(fmt.Sprintf("[%d] In the quiet of the night, the stars above whisper secrets of the universe. We, mere stardust, seek meaning in their cosmic dance, yearning to unlock the mysteries of existence that stretch far beyond our earthly bounds.", count))
- sendSMS(fmt.Sprintf("[%d] Hello, World", count))
wg.Done()
}(i)
diff --git a/api/cmd/loadtest/main.go b/api/cmd/loadtest/main.go
index d8e18868..3e60d688 100644
--- a/api/cmd/loadtest/main.go
+++ b/api/cmd/loadtest/main.go
@@ -20,8 +20,7 @@ func main() {
if err != nil {
log.Fatal("Error loading .env file")
}
-
- bulkSend()
+ sendSingle()
}
func bulkSend() {
@@ -51,7 +50,7 @@ func bulkSend() {
}
func sendSingle() {
- for i := 0; i < 100; i++ {
+ for i := 0; i < 1; i++ {
var responsePayload string
err := requests.
URL("/v1/messages/send").
@@ -60,7 +59,7 @@ func sendSingle() {
// Scheme("http").
Header("x-api-key", os.Getenv("HTTPSMS_KEY")).
BodyJSON(&map[string]string{
- "content": fmt.Sprintf("Load Test[%d]", i),
+ "content": fmt.Sprintf("[%s] In the quiet of the night, the stars above whisper secrets of the universe. We, mere stardust, seek meaning in their cosmic dance, yearning to unlock the mysteries of existence that stretch far beyond our earthly bounds.", time.Now()),
"from": os.Getenv("HTTPSMS_FROM"),
"to": os.Getenv("HTTPSMS_TO"),
"request_id": fmt.Sprintf("load-%s-%d", uuid.NewString(), i),