Skip to content

Commit 39f06b1

Browse files
authored
Merge pull request #716 from nyaruka/fix-WA-button-url
Order components in template and fix max length for D3C
2 parents 9ba8161 + 9956f20 commit 39f06b1

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Diff for: handlers/dialog360/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727

2828
var (
2929
// max for the body
30-
maxMsgLength = 1000
30+
maxMsgLength = 4096
3131
)
3232

3333
func init() {

Diff for: handlers/dialog360/handler_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ var SendTestCasesD3C = []OutgoingTestCase{
432432
},
433433
},
434434
ExpectedRequests: []ExpectedRequest{{
435-
Body: `{"messaging_product":"whatsapp","recipient_type":"individual","to":"250788123123","type":"template","template":{"name":"revive_issue","language":{"policy":"deterministic","code":"en_US"},"components":[{"type":"body","sub_type":"","index":"","parameters":[{"type":"text","text":"Chef"},{"type":"text","text":"tomorrow"}]}]}}`,
435+
Body: `{"messaging_product":"whatsapp","recipient_type":"individual","to":"250788123123","type":"template","template":{"name":"revive_issue","language":{"policy":"deterministic","code":"en_US"},"components":[{"type":"body","parameters":[{"type":"text","text":"Chef"},{"type":"text","text":"tomorrow"}]}]}}`,
436436
}},
437437
ExpectedExtIDs: []string{"157b5e14568e8"},
438438
},

Diff for: handlers/meta/whataspp_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ var whatsappOutgoingTests = []OutgoingTestCase{
401401
},
402402
},
403403
ExpectedRequests: []ExpectedRequest{{
404-
Body: `{"messaging_product":"whatsapp","recipient_type":"individual","to":"250788123123","type":"template","template":{"name":"revive_issue","language":{"policy":"deterministic","code":"en_US"},"components":[{"type":"body","sub_type":"","index":"","parameters":[{"type":"text","text":"Chef"},{"type":"text","text":"tomorrow"}]}]}}`,
404+
Body: `{"messaging_product":"whatsapp","recipient_type":"individual","to":"250788123123","type":"template","template":{"name":"revive_issue","language":{"policy":"deterministic","code":"en_US"},"components":[{"type":"body","parameters":[{"type":"text","text":"Chef"},{"type":"text","text":"tomorrow"}]}]}}`,
405405
}},
406406
ExpectedExtIDs: []string{"157b5e14568e8"},
407407
},
@@ -456,7 +456,7 @@ var whatsappOutgoingTests = []OutgoingTestCase{
456456
},
457457
},
458458
ExpectedRequests: []ExpectedRequest{{
459-
Body: `{"messaging_product":"whatsapp","recipient_type":"individual","to":"250788123123","type":"template","template":{"name":"revive_issue","language":{"policy":"deterministic","code":"en_US"},"components":[{"type":"body","sub_type":"","index":"","parameters":[{"type":"text","text":"Ryan Lewis"},{"type":"text","text":"niño"}]},{"type":"button","sub_type":"quick_reply","index":"0","parameters":[{"type":"payload","payload":"Sip"}]},{"type":"button","sub_type":"quick_reply","index":"1","parameters":[{"type":"text","text":"id00231"}]}]}}`,
459+
Body: `{"messaging_product":"whatsapp","recipient_type":"individual","to":"250788123123","type":"template","template":{"name":"revive_issue","language":{"policy":"deterministic","code":"en_US"},"components":[{"type":"body","parameters":[{"type":"text","text":"Ryan Lewis"},{"type":"text","text":"niño"}]},{"type":"button","sub_type":"quick_reply","index":"0","parameters":[{"type":"payload","payload":"Sip"}]},{"type":"button","sub_type":"quick_reply","index":"1","parameters":[{"type":"text","text":"id00231"}]}]}}`,
460460
}},
461461
ExpectedExtIDs: []string{"157b5e14568e8"},
462462
},

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ type Param struct {
155155

156156
type Component struct {
157157
Type string `json:"type"`
158-
SubType string `json:"sub_type"`
159-
Index string `json:"index"`
158+
SubType string `json:"sub_type,omitempty"`
159+
Index string `json:"index,omitempty"`
160160
Params []*Param `json:"parameters"`
161161
}
162162

0 commit comments

Comments
 (0)