Neue Möglichkeit, offene Stellen auf einer WordPress-Webseite zu veröffentlichen

Min
Min, Frontend Development
21 Sep 2020
Neue Möglichkeit, offene Stellen auf einer WordPress-Webseite zu veröffentlichen

Um das Einstellen von offenen Stellen für das Management einfacher zu gestalten, integrieren wir das Personalmanagement von Personio in die WordPress-Webseite.

In der Regel werden spezielle Plugins zum Veröffentlichen von Stellenangeboten genutzt. Hierzu müssen sich aber sowohl die User als auch HR zunächst registrieren.

Diesen Vorgang können wir verbessern, indem wir Personio und WordPress miteinander verbinden. Damit können wir die Nutzung insbesondere für die HR-Abteilung wesentlich einfacher und angenehmer gestalten.

Vorteile durch die Integration von Personio und WordPress

  1. HR kann offene Stellen direkt aus der Personio-App heraus veröffentlichen. Es ist nicht länger notwendig, Jobs manuell im WordPress-Backend anzulegen.
  2. HR erhält Bewerbungen direkt in der Personio App und kann mit Personios Recruiting Feature die nächsten Schritte einleiten.
Interessiert?
Kontaktieren
Sie uns!

Wie integriere ich Personio und WordPress?

Zum Abrufen offener Positionen wie dieser https://youraccout-jobs.personio.de/xml stellt Personio einen XML-Feed bereit. Wir rufen mit diesem Code das XML mit PHP in WordPress ab.

<?php
$hostname = 'personio'
$lang = getLang();
$positions = simplexml_load_file(
'https://' . $hostname .
'-jobs.personio.de/xml?language=' .
$lang
);
$categories = [];
foreach ($positions->position as $position){
$category = (string)$position->recruitingCategory;
if($category && !in_array($category, $categories)){
$categories[] = $category;
}
}
$translations = [
"full-time" =>  [
"de" => "Vollzeit",
"en" => "Full-time"
],
"part-time" =>  [
"de" => "Teilzeit",
"en" => "Part-time"
],
"permanent" =>  [
"de" => "Festanstellung",
"en" => "Permanent Employment"
],
"intern" =>  [
"de" => "Praktikum",
"en" => "Internship"
],
"trainee" =>  [
"de" => "Trainee Stelle",
"en" => "Trainee Stelle"
],
"freelance" =>  [
"de" => "Freelance Position",
"en" => "Freelance Position"
],
];

// Print job postings

foreach ($positions as $position) {
$detailLink = 'https://' . $hostname . '-jobs.personio.de/job/' . $position->id;
if ($_GET["channel"]) {
$detailLink .= '?_pc=' . $_GET["channel"];
}
echo '<a href="' . $detailLink . ' target="_blank" alt="Job Details">' .
'<h2>' . $position->name . '</h2>' .
'<p>' . $translations[(string)$position->employmentType][$lang] .
', ' . $translations[(string)$position->schedule][$lang] . '</p>' .
'</a>';
}
?>

Dies ist ein Beispiel dafür, wie du ein HTML-Bewerbungsformular auf deiner Seite integrieren kannst.

<form id="personioApplicationForm" class="form-horizontal" method="POST" action="https://api.personio.de/recruiting/applicant" enctype="multipart/form-data">
    <fieldset>
        
        <!-- Pass authentication token -->
        <input name="access_token" type="hidden" value="a8056a2f81a8acd27a68">

        <!-- Pass company and position_id -->
        <input name="company_id" type="hidden" value="000">
        <input name="job_position_id" type="hidden" value="0000">

        <!-- You can pass all applicant system attributes -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="first_name">Tell us your name <sup>*</sup></label>
            <div class="col-md-4">
                <input id="first_name" name="first_name" type="text" placeholder="First name" class="form-control input-md" required="">
                <input id="last_name" name="last_name" type="text" placeholder="Last name" class="form-control input-md" style="margin-top: .5em" required="">
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-4 control-label" for="email">How can we reach you? <sup>*</sup></label>
            <div class="col-md-4">
                <input id="email" name="email" type="text" placeholder="you@example.com" class="form-control input-md" required="">
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-4 control-label" for="channel">Where did you hear first about this job?</label>
            <div class="col-md-4">
                <select id="channel" name="recruiting_channel_id" class="form-control form-select">
                    <option value="" disabled="" selected="">Please select one option</option>
                    <option value="234">LinkedIn</option>
                    <option value="345">Xing</option>
                    <option value="456">Indeed.com</option>
                </select>
            </div>
        </div>

        <!-- You can pass custom applicant attributes as well, e.g. for tracking referrers -->
        <div id="ref" class="form-group" style="display: none">
            <label class="col-md-4 control-label" for="email">Who referred you? <sup>*</sup></label>
            <div class="col-md-4">
                <input id="referrer" name="custom_attribute_863" type="text" placeholder="Full name" class="form-control input-md">
            </div>
        </div>

        <!-- Multiple documents up to 50MB can be passed -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="documents">Upload your cover letter, CV, and references <sup>*</sup><br><span style="font-size: 0.8em">You can select several documents at once</span></label>
            <div class="col-md-4">
                <input id="documents" name="documents[]" class="input-file" type="file" style="margin-top: 10px;" multiple="" required="">
            </div>
        </div>

        <!-- The initial message of the applicant -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="message">Anything else you want to let us know?</label>
            <div class="col-md-4">
                <textarea class="form-control" id="message" name="message" placeholder="Leave us a message" rows="3"></textarea>
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-4 control-label" for="message">Everything ready?</label>
            <div class="col-md-4">
                <input id="submitButton" type="submit" value="Submit application now">
            </div>
        </div>

    </fieldset>
</form>

Diese Integration ist generell recht einfach umzusetzen und wird den Berufsalltag der HR-Abteilung um einiges leichter gestalten.


Nachtrag vom 14.06.2023

Die Recruiting-API in ursprünglicher Version wird am 30. Juni 2023 eingestellt. Das Umstellen auf die neue API bedarf folgender Anpassungen:

1) Anstatt wie gehabt über das Frontend, stellen wir die Anfragen an die Recruiting-API nun mit einem Backend-Dienst.

Dazu benötigen wir folgende neue Funktion im Header, welche das Hochladen von Dokumenten ermöglicht.

<?php

private function personio_upload_documents_application(array $document) {
	$response = $client->request('POST', 'https://api.personio.de/v1/recruiting/applications/documents', [
	  'headers' => [
	    'X-Company-ID' => 'your-company-id',
			'Accept'       => 'application/json',
			'Content-Type'  => 'multipart/form-data',
	    'authorization' => 'Bearer you-token',
	  ],
		'body' => $your_file_upload
	  ]
	]);
}

Der Endpoint für die Abfrage an die neue Recruiting-API sieht dann wie folgt aus:

<?php

$personio_documents = $this->personio_upload_documents_application($documents['file']);

$args = [
		'job_position_id'  => $params['job_position_id'],
		'first_name'       => $params['first_name'],
		'last_name'        => $params['last_name'],
		'email'            => $params['email'],
		'recruiting_channel_id' => $params['recruiting_channel_id'],
		'message'          => $params['message'],
		'attributes'       => [
		    [
		        'id'    => 'custom_attribute_863',
		        'value' => $params['custom_attribute_863']
		    ],
     ],
		'file'          => [
	    [
	        'uuid' => $personio_documents['body']->uuid ?? '',
	        'original_filename' => $personio_documents['body']->original_filename ?? '',
	        'category' => 'cv'
	    ]
		],
  ];

$response = $client->request('POST', 'https://api.personio.de/v1/recruiting/applications', [
  'body' => $args,
  'headers' => [
    'X-Company-ID' => 'your-company-id',
    'accept' => 'application/json',
    'authorization' => 'Bearer you-token',
    'content-type' => 'application/json',
  ],
]);

2) HTML Code anpassen

Die Felder “access_token” und “company_id” können gelöscht werden, da diese nun über das Backend abgerufen werden.

<input name="access_token" type="hidden" value="a8056a2f81a8acd27a68">
<input name="company_id" type="hidden" value="000">

Die „action“ im Bewerbungsformular muss auf die neuen Endpunkte angepasst werden.

Ursprünglich:

<form id="personioApplicationForm" class="form-horizontal" method="POST" action="https://api.personio.de/recruiting/applicant" enctype="multipart/form-data">

Neu:

<form id="personioApplicationForm" class="form-horizontal" method="POST" action="/your-custom-api-recruiting" enctype="multipart/form-data">

Das fertige HTML sieht dann folgendermaßen aus:

<form id="personioApplicationForm" class="form-horizontal" method="POST" action="/your-custom-api-recruiting" enctype="multipart/form-data">
    <fieldset>
        <!-- Pass company and position_id -->
        <input name="job_position_id" type="hidden" value="0000">

        <!-- You can pass all applicant system attributes -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="first_name">Tell us your name <sup>*</sup></label>
            <div class="col-md-4">
                <input id="first_name" name="first_name" type="text" placeholder="First name" class="form-control input-md" required="">
                <input id="last_name" name="last_name" type="text" placeholder="Last name" class="form-control input-md" style="margin-top: .5em" required="">
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-4 control-label" for="email">How can we reach you? <sup>*</sup></label>
            <div class="col-md-4">
                <input id="email" name="email" type="text" placeholder="you@example.com" class="form-control input-md" required="">
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-4 control-label" for="channel">Where did you hear first about this job?</label>
            <div class="col-md-4">
                <select id="channel" name="recruiting_channel_id" class="form-control form-select">
                    <option value="" disabled="" selected="">Please select one option</option>
                    <option value="234">LinkedIn</option>
                    <option value="345">Xing</option>
                    <option value="456">Indeed.com</option>
                </select>
            </div>
        </div>

        <!-- You can pass custom applicant attributes as well, e.g. for tracking referrers -->
        <div id="ref" class="form-group" style="display: none">
            <label class="col-md-4 control-label" for="email">Who referred you? <sup>*</sup></label>
            <div class="col-md-4">
                <input id="referrer" name="custom_attribute_863" type="text" placeholder="Full name" class="form-control input-md">
            </div>
        </div>

        <!-- Multiple documents up to 50MB can be passed -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="documents">Upload your cover letter, CV, and references <sup>*</sup><br><span style="font-size: 0.8em">You can select several documents at once</span></label>
            <div class="col-md-4">
                <input id="documents" name="documents[]" class="input-file" type="file" style="margin-top: 10px;" multiple="" required="">
            </div>
        </div>

        <!-- The initial message of the applicant -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="message">Anything else you want to let us know?</label>
            <div class="col-md-4">
                <textarea class="form-control" id="message" name="message" placeholder="Leave us a message" rows="3"></textarea>
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-4 control-label" for="message">Everything ready?</label>
            <div class="col-md-4">
                <input id="submitButton" type="submit" value="Submit application now">
            </div>
        </div>

    </fieldset>
</form>

Haben Sie Fragen oder benötigen eine individuelle Beratung zu dem, was Sie gerade gelesen haben? Zögern Sie nicht, uns zu kontaktieren! Besuchen Sie unsere Kontaktseite und lassen Sie uns ein Gespräch darüber beginnen, wie wir Ihnen helfen können, Ihre Ziele zu erreichen.

Mucki

Jetzt Beratungsgespräch vereinbaren:

Marcus Renz

Geschäftsführung

+49 711 217258 42

Email schreiben