diff --git a/src/service/core.rs b/src/service/core.rs index 59acfff..d44a61b 100644 --- a/src/service/core.rs +++ b/src/service/core.rs @@ -69,6 +69,9 @@ impl Service { }; let events = events.unwrap_or_default(); + let mut sendmsg = swoosh::SendMsg::default(); + sendmsg.load_config(&self.app.twilio_config.auth_token, &self.app.twilio_config.phone_number, &self.app.twilio_config.service_sid, &self.app.twilio_config.account_sid); + for event in &events { println!("Event: {event:?}"); let contact = &match contacts.get(&event.contact_id).await { @@ -105,8 +108,10 @@ impl Service { let twilio_config = &self.app.twilio_config; println!("Config: {twilio_config:?}"); println!("SM: {scheduled_message:?}"); + sendmsg.load_message(&message.content); + sendmsg.load_recipient(&contact.phone_number); - match swoosh::twilio::api::send_message(message, contact, ¶m, twilio_config).await { + match sendmsg.send_message(¶m).await { Ok(resp) => { println!("Message scheduled"); // MER response