story-kit: merge 322_story_whatsapp_24_hour_messaging_window_and_template_support

This commit is contained in:
Dave
2026-03-19 23:58:31 +00:00
parent e3ade4cca5
commit 02947700ba
6 changed files with 496 additions and 16 deletions

View File

@@ -372,6 +372,10 @@ pub async fn run_bot(
Arc::new(crate::whatsapp::WhatsAppTransport::new(
config.whatsapp_phone_number_id.clone().unwrap_or_default(),
config.whatsapp_access_token.clone().unwrap_or_default(),
config
.whatsapp_notification_template
.clone()
.unwrap_or_else(|| "pipeline_notification".to_string()),
))
}
_ => {
@@ -1396,7 +1400,7 @@ mod tests {
ambient_rooms: Arc::new(std::sync::Mutex::new(HashSet::new())),
agents: Arc::new(AgentPool::new_test(3000)),
htop_sessions: Arc::new(TokioMutex::new(HashMap::new())),
transport: Arc::new(crate::whatsapp::WhatsAppTransport::new("test-phone".to_string(), "test-token".to_string())),
transport: Arc::new(crate::whatsapp::WhatsAppTransport::new("test-phone".to_string(), "test-token".to_string(), "pipeline_notification".to_string())),
};
// Clone must work (required by Matrix SDK event handler injection).
let _cloned = ctx.clone();

View File

@@ -80,6 +80,13 @@ pub struct BotConfig {
/// and configure it in the Meta webhook settings).
#[serde(default)]
pub whatsapp_verify_token: Option<String>,
/// Name of the approved Meta message template used for pipeline
/// notifications when the 24-hour messaging window has expired.
///
/// The template must be registered in the Meta Business Manager before
/// use. Defaults to `"pipeline_notification"`.
#[serde(default)]
pub whatsapp_notification_template: Option<String>,
}
fn default_transport() -> String {