How to customize a link with a custom module?
The CSS class is a sub-key of the #attributes of a render array like $build:

function private_message_contact_button_node_view_alter(&amp;$build) {
  if (array_key_exists('private_message_link', $build)) {
    $build['private_message_link']['#attributes']['class'] = array('button button--primary', 'btn');
  }
}