Skip to main content
2 of 2
added 1 character in body

Try this one:

$fields = \Drupal::service('entity_field.manager')->getFieldDefinitions('contact_message', 'personal');

You can change personal to your contact form bundle.