Skip to content

Commit 6137e85

Browse files
committed
Add support for read msg status
1 parent ff06bf4 commit 6137e85

File tree

8 files changed

+9
-8
lines changed

8 files changed

+9
-8
lines changed

Diff for: handlers/kaleyra/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ var statusMapping = map[string]courier.MsgStatus{
107107
"0": courier.MsgStatusFailed,
108108
"sent": courier.MsgStatusWired,
109109
"delivered": courier.MsgStatusDelivered,
110-
"read": courier.MsgStatusDelivered,
110+
"read": courier.MsgStatusRead,
111111
}
112112

113113
// receiveStatus is our HTTP handler function for outgoing messages statuses

Diff for: handlers/kaleyra/handler_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ var incomingCases = []IncomingTestCase{
7373
URL: receiveStatusURL + "?id=58f86fab-85c5-4f7c-9b68-9c323248afc4%3A0&status=read",
7474
ExpectedRespStatus: 200,
7575
ExpectedBodyContains: `"type":"status"`,
76-
ExpectedStatuses: []ExpectedStatus{{ExternalID: "58f86fab-85c5-4f7c-9b68-9c323248afc4:0", Status: courier.MsgStatusDelivered}},
76+
ExpectedStatuses: []ExpectedStatus{{ExternalID: "58f86fab-85c5-4f7c-9b68-9c323248afc4:0", Status: courier.MsgStatusRead}},
7777
},
7878
{
7979
Label: "Receive Invalid Status",

Diff for: handlers/meta/whatsapp/api.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import "github.com/nyaruka/courier"
66
var StatusMapping = map[string]courier.MsgStatus{
77
"sent": courier.MsgStatusSent,
88
"delivered": courier.MsgStatusDelivered,
9-
"read": courier.MsgStatusDelivered,
9+
"read": courier.MsgStatusRead,
1010
"failed": courier.MsgStatusFailed,
1111
}
1212

Diff for: handlers/twiml/handlers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ var statusMapping = map[string]courier.MsgStatus{
107107
"failed": courier.MsgStatusFailed,
108108
"sent": courier.MsgStatusSent,
109109
"delivered": courier.MsgStatusDelivered,
110-
"read": courier.MsgStatusDelivered,
110+
"read": courier.MsgStatusRead,
111111
"undelivered": courier.MsgStatusFailed,
112112
}
113113

Diff for: handlers/twiml/handlers_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ var testCases = []IncomingTestCase{
175175
URL: statusURL,
176176
Data: statusRead,
177177
ExpectedRespStatus: 200,
178-
ExpectedBodyContains: `"status":"D"`,
178+
ExpectedBodyContains: `"status":"R"`,
179179
ExpectedStatuses: []ExpectedStatus{
180-
{ExternalID: "SMe287d7109a5a925f182f0e07fe5b223b", Status: courier.MsgStatusDelivered},
180+
{ExternalID: "SMe287d7109a5a925f182f0e07fe5b223b", Status: courier.MsgStatusRead},
181181
},
182182
PrepRequest: addValidSignature,
183183
},

Diff for: handlers/whatsapp_legacy/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ var waStatusMapping = map[string]courier.MsgStatus{
325325
"sending": courier.MsgStatusWired,
326326
"sent": courier.MsgStatusSent,
327327
"delivered": courier.MsgStatusDelivered,
328-
"read": courier.MsgStatusDelivered,
328+
"read": courier.MsgStatusRead,
329329
"failed": courier.MsgStatusFailed,
330330
}
331331

Diff for: handlers/zenvia/handlers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ var statusMapping = map[string]courier.MsgStatus{
134134
"NOT_DELIVERED": courier.MsgStatusFailed,
135135
"SENT": courier.MsgStatusSent,
136136
"DELIVERED": courier.MsgStatusDelivered,
137-
"READ": courier.MsgStatusDelivered,
137+
"READ": courier.MsgStatusRead,
138138
}
139139

140140
type statusPayload struct {

Diff for: status.go

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const (
1313
MsgStatusWired MsgStatus = "W"
1414
MsgStatusErrored MsgStatus = "E"
1515
MsgStatusDelivered MsgStatus = "D"
16+
MsgStatusRead MsgStatus = "R"
1617
MsgStatusFailed MsgStatus = "F"
1718
NilMsgStatus MsgStatus = ""
1819
)

0 commit comments

Comments
 (0)