Can I use deflect missile if I get an ally to shoot me?

Considering it says "you can use your reaction to deflect or catch the missile when you are hit by a ranged weapon attack." If , for example, there’s a wall a goblin is hiding behind. It’s my Ranged Ally’s turn and they can see me but can’t see the goblin because it’s behind the wall. Could my ally shoot an arrow or any weapon projectile at me so I could use Deflect Missile?