ROCKVILLE, Md. — Under the banner of her “Be Best” campaign, Melania Trump, the first lady, told a group of cyberbullying prevention experts on Monday that social media “can be destructive and harmful when used incorrectly.”

Just after she spoke, President Trump unleashed a barrage of tweets in which he called the former director of the C.I.A. a “hack” and mocked the effectiveness of the Justice Department, among other digital insults. Later on Monday, Mrs. Trump added to a day of dissonant messaging from the Trump White House when her office announced a solo trip for the first lady this fall to Africa — a continent whose countries and citizens her husband has disparaged with coarse language.

Mrs. Trump, whose policy director left the White House a few weeks ago, has kept a light public schedule in promoting her child-focused campaign since she launched it in May. Her visit to the Federal Partners in Bullying Prevention session, held at the Health Resources and Services Administration in a Washington suburb, was one of the more visible efforts that Mrs. Trump has made on behalf of the campaign.

“In today’s global society, social media is an inevitable part of our children’s daily lives,” Mrs. Trump said, reading from prepared remarks. “It can be used in many positive ways, but can also be destructive and harmful when used incorrectly.”