@@ -273,7 +273,7 @@ def send_message_to_urn(self, message, target_urn, interrupt=False):
273
273
274
274
log .info ("Sending a message to an individual..." )
275
275
log .debug (f"Sending to '{ target_urn } ' the message '{ message } '..." )
276
- response : Broadcast = self .rapid_pro .create_broadcast (message , urns = [target_urn ])
276
+ response = self .rapid_pro .create_broadcast (message , urns = [target_urn ])
277
277
log .info (f"Message send request created with broadcast id { response .id } " )
278
278
return response .id
279
279
@@ -295,7 +295,7 @@ def send_message_to_urns(self, message, target_urns, interrupt=False):
295
295
log .info (f"Sending a message to { len (urns )} URNs..." )
296
296
log .debug (f"Sending to { urns } ..." )
297
297
batch = []
298
- ids = []
298
+ broadcast_ids = []
299
299
interrupted = 0
300
300
sent = 0
301
301
@@ -307,22 +307,20 @@ def send_message_to_urns(self, message, target_urns, interrupt=False):
307
307
interrupted += len (batch )
308
308
log .info (f"Interrupted { interrupted } / { len (urns )} URNs" )
309
309
310
- response : Broadcast = self .rapid_pro .create_broadcast (message , urns = batch )
311
- ids .append (response .id )
310
+ response = self .rapid_pro .create_broadcast (message , urns = batch )
311
+ broadcast_ids .append (response .id )
312
312
sent += len (batch )
313
313
batch = []
314
+ log .info (f"Sent { sent } / { len (urns )} URNs" )
314
315
if len (batch ) > 0 :
315
316
if interrupt :
316
317
self .rapid_pro .bulk_interrupt_contacts (batch )
317
318
interrupted += len (batch )
318
319
response : Broadcast = self .rapid_pro .create_broadcast (message , urns = batch )
319
320
sent += len (batch )
320
-
321
- ids .append (response .id )
322
-
323
-
324
- log .info (f"Interrupted { interrupted } / { len (urns )} URNs" )
325
- log .info (f"Sent { sent } / { len (urns )} URNs" )
321
+ broadcast_ids .append (response .id )
322
+ log .info (f"Interrupted { interrupted } / { len (urns )} URNs" )
323
+ log .info (f"Sent { sent } / { len (urns )} URNs" )
326
324
327
325
log .info (f"Message send request created with broadcast ids { ids } " )
328
326
return ids
0 commit comments