Using Airpods pro 2 double pinch to Trigger BTT Action

I already have a script for toggle mute for my mic, I just want a way to do it via my AirPods like I have on iPhone. [Double pinch my Airpods]

if input volume of (get volume settings) = 0 then set volume input volume 100 else set volume input volume 0 end if

Thanks!