diff --git a/bin/pudoxd/src/main.rs b/bin/pudoxd/src/main.rs index a946be4..841038d 100644 --- a/bin/pudoxd/src/main.rs +++ b/bin/pudoxd/src/main.rs @@ -30,32 +30,34 @@ async fn webhook_handler( ) -> &'static str { tracing::info!("Webhook received"); - let res = linear - .send(serde_json::json!({ - "query": r#" - mutation AgentActivityCreate($input: AgentActivityCreateInput!) { - agentActivityCreate(input: $input) { - success + if payload.event_type == "AgentSessionEvent" && payload.action == "created" { + let res = linear + .send(serde_json::json!({ + "query": r#" + mutation AgentActivityCreate($input: AgentActivityCreateInput!) { + agentActivityCreate(input: $input) { + success + } } - } - "#.to_string(), - "variables": { - "input": { - "agentSessionId": payload.agent_session.id, - "content": { - "type": "thought", - "body": "Received" + "#.to_string(), + "variables": { + "input": { + "agentSessionId": payload.agent_session.id, + "content": { + "type": "thought", + "body": "Received" + } } } - } - })) - .await; + })) + .await; - match res { - Ok(r) => { - tracing::info!("Mutation response: {:}", r); + match res { + Ok(r) => { + tracing::info!("Mutation response: {:}", r); + } + Err(e) => tracing::error!("Failed to send mutation: {}", e), } - Err(e) => tracing::error!("Failed to send mutation: {}", e), } "Webhook processed"