A family trapped above a 40-foot waterfall was rescued after hikers found an SOS message that the family sent in a water bottle.

Curtis Whitson, 44, his girlfriend, and his 13-year-old son had been on a four-day camping trip in Arroyo Seco, California, when they were set to hike a remote gorge.

But Whitson discovered he was trapped when he noticed that the rope used to descend from the top of the gorge— which was there when he hiked the area several years earlier— was missing.

Because the group did not have cell service, they crafted an SOS message out of the rocks and scratched “HELP” on a water bottle that the group used to send down the gorge. The bottle also contained an SOS message inside.

“I knew that our friends would call somebody at some point when we didn’t show up. But I was worried about how long it might take for anyone to find us,” Whitson’s girlfriend Krystal Ramirez told the Washington Post.

The family then sent off the bottle through a narrow passageway in a waterfall, hoping someone would find them as they spent the night at the top of the gorge.

Two hikers eventually spotted the green water bottle nearby and called for a search and rescue team at a nearby campsite.

California Highway Patrol helicopter pilot Todd Brethour did a flyover that evening before the end of his shift, finding the family using infrared technology and night vision goggles.

“We were all dead asleep when we suddenly heard the helicopter right above us,” Ramirez said.

Because it was too dark to do a rescue operation, the highway patrol set a second helicopter at 10 a.m. the next day to lift each person to safety.

“As you can imagine, they were very happy to see us,” pilot Joe Kingman said.