WASHINGTON — As Saudi Arabia’s leaders prepared to make a pitch to the White House for a visit by President Trump, a PowerPoint presentation was put together complete with slides describing Saudi demographics, investments in the United States and ambitious plans for reform.

Another slide showed pictures of three palaces Mr. Trump could choose to stay at should he come, including “His Majesty’s weekend personal residence.” Ultimately, someone must have thought better of it, because that slide was not shown. But the pitch worked. Mr. Trump heads to Riyadh on Friday, the first stop in his first overseas trip since taking office.

For foreign leaders trying to figure out the best way to approach an American president unlike any they have known, it is a time of experimentation. Embassies in Washington trade tips and ambassadors send cables to presidents and ministers back home suggesting how to handle a mercurial, strong-willed leader with no real experience on the world stage, a preference for personal diplomacy and a taste for glitz.

After four months of interactions between Mr. Trump and his counterparts, foreign officials and their Washington consultants say certain rules have emerged: Keep it short — no 30-minute monologue for a 30-second attention span. Do not assume he knows the history of the country or its major points of contention. Compliment him on his Electoral College victory. Contrast him favorably with President Barack Obama. Do not get hung up on whatever was said during the campaign. Stay in regular touch. Do not go in with a shopping list but bring some sort of deal he can call a victory.