CNN  — 

Three boaters clung to a makeshift raft of ice chests and fended off shark attacks and jellyfish stings in the waters near Empire, Louisiana, until they were rescued 28 hours later, all thanks to a miraculous text message.

The three longtime friends set out on October 8 to fish red snapper like they had many times before. But rough seas soon began disturbing their fishing boat, lapping water inside the vessel.

“The minute we saw the back of the boat start taking on water, I knew it right then and there,” Phong Le told NBC’s “Today” show on Wednesday. “It was like the perfect storm for the perfect accident.”

The front of the boat was tied to an oil rig, but the waves worsened, crashing aboard the boat. The men had about two minutes to react before their 24-foot center console boat sank around 10 a.m., according to an interview with “Good Morning America.”

The men quickly created an improvised raft, tying two ice chests together with Le’s bandana.

“Every time I go fishing, I wear a bandana because I lose a hat every time,” Le said.

They tried to propel themselves toward the oil rig to call for help.

“Every oil rig has some kind of phone, or something on there, so we figured we could get on there and we could make a distress call,” Le said. But they never made it.

A shark attacks

As the sky grew dark, the three men clung to the coolers, the moon providing some comfort.

“Good thing there was full moon out because we had light,” Luan Nguyen told NBC. “We couldn’t barely see anything, so we just drifted at night.”

Until an unwelcome visitor arrived. A shark battered into Nguyen and a fight for survival ensued.

“The shark hit the life vest and I tried to push him off. He wouldn’t go away, so I jabbed him in his eyes,” Nguyen told NBC. “I put my thumbs in his eyes and he took off. I got a little couple scars, but you know.”

One of the boater's life jackets was torn due to shark attacks.

Other sea creatures made their presence known too, making things even harder for the floating men.

“Every 15 to 20 minutes, you were constantly being stung by jellyfish,” Le told NBC.

“In the middle of the night, I woke up with this jellyfish this big just in my lap,” Le added, motioning during the interview that the jellyfish was about as wide as he was.

The men stayed mostly silent through it all, bobbing in the water.

“It was very cold, so we were just trying to stay warm, just trying to hold each other and stay warm,” Le said.

They were spotted from the air

Le separated from the group the next morning. He wanted to swim about five miles to a shrimp boat and call for help, he told NBC. But when he got about a mile out, the shrimper left, he said.

Trying to figure out his location, Le took out his cell phone, protected by a waterproof case – it had less than 5% battery and was in airplane mode to save the charge.

“I opened up my phone and that’s when all of a sudden, all of the text messages came in,” Le said. “The whole time I didn’t have no signal but out in the middle of the Gulf of Mexico, I had a signal.”

Le didn’t waste time. He said he screen-grabbed his location on a map and texted it to a friend. The phone died soon afterward.

The friend received the message and contacted the Coast Guard with the boaters’ location.

The men didn’t know it, but before the miraculous text message went through, the Coast Guard was already on their way, Lt. Katy Caraway from Air Station New Orleans told CNN on Thursday. She was the co-pilot of a Jayhawk helicopter that helped rescue the men.

Five minutes into their flight, Caraway said they got the radio transmission that there was new information they could use in the search. It took them 25 minutes to get to the location sent in the text message.

After 15 to 20 minutes of searching the waters, a pilot from a Coast Guard airplane, cruising at an altitude of 1,000 feet, spotted one of the men waving from the water, Caraway said.

A Coast Guard  Jayhawk aircrew treats the rescued boaters for injuries.

“Le, he was the first survivor that we picked up and he was actually the one who got separated from the rest of his group because he had tried swimming to a shrimp boat to call for help,” Caraway told CNN.

A rescue swimmer jumped from the helicopter and swam over to check on Le, Caraway said.