Mexico sent a strong message this week: We have a lot of other friends outside North America.

Officials from Mexico's agriculture ministry brought 17 Mexican companies to Brazil this week to talk about buying more grain, soy and corn in South America. (Mexico is one of the top buyers of US corn.)

Economic Secretary Ildefonso Guajardo announced on Thursday he's taking a trip to China in September.

These moves come amid Trump's hostile messages to Mexico. He's threatened to terminate NAFTA, the free trade deal with Canada and Mexico. Trump also threatened taxes on imports from Mexico and on companies that move jobs to Mexico.

Related: Senate confirms Trump's top NAFTA negotiator

Mexico's travel plans coincide with the US Senate's confirmation of Trump's top NAFTA negotiator on Thursday, setting the stage for NAFTA talks, which should begin in August or September.

"It sends a signal that we have a lot of alternatives," Guajardo said on Thursday about the China trip.

It's not just Brazil and China either. Mexican officials are in "accelerated" trade talks with their counterparts in the European Union to update a trade agreement. They're also meeting with Argentine officials.

"We're prepared, not worried," Raul Urteaga, general coordinator of international affairs for Mexico's agriculture ministry, told CNNMoney from Sao Paulo, Brazil. "We're very interested in opening new markets for our exports and in having reliable trade partners."

Mexican officials stress that they were trying to diversify their economy well before Trump. However, they concede that Trump's election has ramped up the urgency to strengthen trade relationships with other countries.

Related: Trump on NAFTA: 'Will I settle for less than I go in with? Yes'

Still, Mexico heavily depends on the US and pivoting away will be a long-term challenge.

About 80% of Mexico's exports go to the US, and millions of Mexicans living in the US provide a key source of income -- remittances -- to mostly low-income friends and relatives in Mexico. Hundreds of companies have operations on both sides of the border -- a result of NAFTA, which became law in 1994.

For its part, about 6 million US jobs also depend on trade with Mexico, according to the US Chamber of Commerce.

Those ties are under siege in the Trump era. Other countries see an opportunity and are welcoming Mexico with open arms.

"That is a great opportunity to turn around and look a bit more to South America," Argentina President Mauricio Macri told CNN in April. "This shows that it's better to keep and to deepen relationships with many other countries."