Skip to content

Commit 3fa22cb

Browse files
committed
fix: webhook payload entry timestamp type must be int not string
Signed-off-by: sarthakjdev <jsarthak448@gmail.com>
1 parent f6b5cd3 commit 3fa22cb

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

manager/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ type WhatsappApiNotificationPayloadSchemaType struct {
234234
type Entry struct {
235235
Id string `json:"id"`
236236
Changes []Change `json:"changes"`
237-
Time *string `json:"time"`
237+
Time *int64 `json:"time"`
238238
}
239239

240240
type WebhookFieldEnum string

manager/webhook_manager.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (wh *WebhookManager) PostRequestHandler(c echo.Context) error {
133133
}
134134
err = wh.handleAccountReviewSubscriptionEvents(events.BaseBusinessAccountEvent{
135135
BusinessAccountId: entry.Id,
136-
Timestamp: *entry.Time,
136+
Timestamp: fmt.Sprint(*entry.Time),
137137
}, accountReviewValue)
138138
if err != nil {
139139
fmt.Println("Error handling messages subscription events:", err)
@@ -151,7 +151,7 @@ func (wh *WebhookManager) PostRequestHandler(c echo.Context) error {
151151
}
152152
err = wh.handleAccountAlertsSubscriptionEvents(events.BaseBusinessAccountEvent{
153153
BusinessAccountId: entry.Id,
154-
Timestamp: *entry.Time,
154+
Timestamp: fmt.Sprint(*entry.Time),
155155
}, accountAlertValue)
156156
if err != nil {
157157
fmt.Println("Error handling messages subscription events:", err)
@@ -169,7 +169,7 @@ func (wh *WebhookManager) PostRequestHandler(c echo.Context) error {
169169
}
170170
wh.handleAccountUpdateSubscriptionEvents(events.BaseBusinessAccountEvent{
171171
BusinessAccountId: entry.Id,
172-
Timestamp: *entry.Time,
172+
Timestamp: fmt.Sprint(*entry.Time),
173173
}, accountUpdate)
174174
if err != nil {
175175
fmt.Println("Error handling messages subscription events:", err)
@@ -187,7 +187,7 @@ func (wh *WebhookManager) PostRequestHandler(c echo.Context) error {
187187
}
188188
wh.handleTemplateCategoryUpdateSubscriptionEvents(events.BaseBusinessAccountEvent{
189189
BusinessAccountId: entry.Id,
190-
Timestamp: *entry.Time,
190+
Timestamp: fmt.Sprint(*entry.Time),
191191
}, templateCategoryUpdate)
192192
if err != nil {
193193
fmt.Println("Error handling messages subscription events:", err)
@@ -205,7 +205,7 @@ func (wh *WebhookManager) PostRequestHandler(c echo.Context) error {
205205
}
206206
wh.handleMessageTemplateQualitySubscriptionEvents(events.BaseBusinessAccountEvent{
207207
BusinessAccountId: entry.Id,
208-
Timestamp: *entry.Time,
208+
Timestamp: fmt.Sprint(*entry.Time),
209209
}, qualityUpdate)
210210
if err != nil {
211211
fmt.Println("Error handling messages subscription events:", err)
@@ -223,7 +223,7 @@ func (wh *WebhookManager) PostRequestHandler(c echo.Context) error {
223223
}
224224
wh.handleMessageTemplateStatusSubscriptionEvents(events.BaseBusinessAccountEvent{
225225
BusinessAccountId: entry.Id,
226-
Timestamp: *entry.Time,
226+
Timestamp: fmt.Sprint(*entry.Time),
227227
}, statusUpdate)
228228
if err != nil {
229229
fmt.Println("Error handling messages subscription events:", err)
@@ -241,7 +241,7 @@ func (wh *WebhookManager) PostRequestHandler(c echo.Context) error {
241241
}
242242
wh.handlePhoneNumberNameSubscriptionEvents(events.BaseBusinessAccountEvent{
243243
BusinessAccountId: entry.Id,
244-
Timestamp: *entry.Time,
244+
Timestamp: fmt.Sprint(*entry.Time),
245245
}, nameUpdate)
246246
if err != nil {
247247
fmt.Println("Error handling messages subscription events:", err)
@@ -259,7 +259,7 @@ func (wh *WebhookManager) PostRequestHandler(c echo.Context) error {
259259
}
260260
wh.handlePhoneNumberQualitySubscriptionEvents(events.BaseBusinessAccountEvent{
261261
BusinessAccountId: entry.Id,
262-
Timestamp: *entry.Time,
262+
Timestamp: fmt.Sprint(*entry.Time),
263263
}, qualityUpdate)
264264
if err != nil {
265265
fmt.Println("Error handling messages subscription events:", err)
@@ -277,7 +277,7 @@ func (wh *WebhookManager) PostRequestHandler(c echo.Context) error {
277277
}
278278
wh.handleBusinessCapabilitySubscriptionEvents(events.BaseBusinessAccountEvent{
279279
BusinessAccountId: entry.Id,
280-
Timestamp: *entry.Time,
280+
Timestamp: fmt.Sprint(*entry.Time),
281281
}, capabilityUpdate)
282282
if err != nil {
283283
fmt.Println("Error handling messages subscription events:", err)

0 commit comments

Comments
 (0)