Skip to content

Commit

Permalink
Fail messages when we hit contact pair limit
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Dec 16, 2024
1 parent 30e553d commit 1ecce3f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
7 changes: 0 additions & 7 deletions handlers/meta/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"fmt"
"net/http"
"net/url"
"slices"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -52,8 +51,6 @@ var (
"account": "ACCOUNT_UPDATE",
"agent": "HUMAN_AGENT",
}

wacThrottlingErrorCodes = []int{4, 80007, 130429, 131048, 131056, 133016}
)

// keys for extra in channel events
Expand Down Expand Up @@ -1093,10 +1090,6 @@ func (h *handler) requestWAC(payload whatsapp.SendRequest, accessToken string, r
return courier.ErrResponseUnparseable
}

if slices.Contains(wacThrottlingErrorCodes, respPayload.Error.Code) {
return courier.ErrConnectionThrottled
}

if respPayload.Error.Code != 0 {
return courier.ErrFailedWithReason(strconv.Itoa(respPayload.Error.Code), respPayload.Error.Message)
}
Expand Down
11 changes: 0 additions & 11 deletions handlers/meta/whataspp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,17 +696,6 @@ var whatsappOutgoingTests = []OutgoingTestCase{
},
ExpectedError: courier.ErrResponseUnparseable,
},
{
Label: "Error Channel Contact Pair limit hit",
MsgText: "Pair limit",
MsgURN: "whatsapp:250788123123",
MockResponses: map[string][]*httpx.MockResponse{
"*/12345_ID/messages": {
httpx.NewMockResponse(403, nil, []byte(`{ "error": {"message": "(#131056) (Business Account, Consumer Account) pair rate limit hit","code": 131056 }}`)),
},
},
ExpectedError: courier.ErrConnectionThrottled,
},
{
Label: "Error Throttled",
MsgText: "Error",
Expand Down

0 comments on commit 1ecce3f

Please sign in to comment.