@@ -5,7 +5,20 @@ import {
5
5
createWhatsAppTemplate ,
6
6
} from "@/lib/twilio" ;
7
7
import nextConfig from "../../next.config" ;
8
- import { getEventRegistrationTemplate , getHelpPrivacyTemplate , getOrderCancelledTemplate , getOrderConfirmationTemplate , getOrderReadyTemplate , getOrderReminderTemplate , getReadyToOrderLimitlessTemplate , getReadyToOrderLimitlessWithoutEmailValidationTemplate , getReadyToOrderTemplate , getReadyToOrderWithoutEmailValidationTemplate , getWrongOrderTemplate , WhatsAppTemplate } from "./buildContentTemplates" ;
8
+ import {
9
+ getEventRegistrationTemplate ,
10
+ getHelpPrivacyTemplate ,
11
+ getOrderCancelledTemplate ,
12
+ getOrderConfirmationTemplate ,
13
+ getOrderReadyTemplate ,
14
+ getOrderReminderTemplate ,
15
+ getReadyToOrderLimitlessTemplate ,
16
+ getReadyToOrderLimitlessWithoutEmailValidationTemplate ,
17
+ getReadyToOrderTemplate ,
18
+ getReadyToOrderWithoutEmailValidationTemplate ,
19
+ getWrongOrderTemplate ,
20
+ WhatsAppTemplate ,
21
+ } from "./buildContentTemplates" ;
9
22
10
23
// this script runs mostly sequentially. Use a throttled queue later to optimize if needed
11
24
@@ -46,12 +59,12 @@ async function createWhatsAppTemplates() {
46
59
) ;
47
60
48
61
if ( Boolean ( OVERRIDE_TEMPLATES ) ) {
49
- try {
50
- for await ( const t of templates ) {
62
+ for await ( const t of templates ) {
63
+ try {
51
64
await deleteWhatsAppTemplate ( t . sid ) ; // Sequentially delete all templates to avoid rate limiting
65
+ } catch ( e : any ) {
66
+ console . error ( "Error deleting WhatsApp Templates " , e . message ) ;
52
67
}
53
- } catch ( e : any ) {
54
- console . error ( "Error deleting WhatsApp Templates " , e . message ) ;
55
68
}
56
69
console . log ( `Deleted ${ templates . length } templates.` ) ;
57
70
templates = ( await getAllWhatsAppTemplates ( ) ) . filter ( ( t ) =>
0 commit comments