This is a bit related to How can I send messages over long distances?
However, this concerns D & D5e and my question is address to Pathfinder.
I have an idea of the catchy story and could use some help to clarify the logic required.
Scenario: An NPC is trapped in a crypt / dungeon.
The PCs are in another area of the plane, exploring a dungeon / cave.
When the PCs cross a tunnel, they go out into the desert and cross the plane.
Upon arrival, the PCs see a call for audio / visual help. (Think Princess Leia "Help me Obi-Wan Kenobi.")
They are now near the dungeon where the NPC is trapped.
QUESTION: How can an NPC send a one way communication that is triggered when it detects nearby humanoids?
A good answer will explain the spell / magic used to perform the communication. And explain how he will know that the computers have arrived (so the message can be delivered) OR if the message is looping. The spell does not have to report to the NPC when it has responded.
A good answer will also explain: how the cave could be connected to teleport / attract players close enough for the rescue attempt.