Insert data into entity programmatically
Yep. Just use any of the methods available to create the entity and save it.

use Drupal\contact\Entity\Message;

$message = Message::create([
    // And other fields required...
    'subject' =&gt; 'Subject',
    'message' =&gt; 'Message...',
    'recipient' =&gt; 1,
]);
$message-&gt;save();