docs/Power features/SoSci Survey
connect your survey tool

SoSci Survey.

Send the message id as the reserved r parameter (auto-stored in REF), then redirect with a PHP redirect() on the final page.

1 · Pass the Samply IDs into the survey

The reserved r parameter is auto-stored in the built-in REF variable; other custom u_ parameters are captured with a "Device and Transmitted Variables" question on the first page.

  1. Send the message id as the reserved parameter r (e.g. ?r=%MESSAGE_ID%). SoSci automatically stores r in the built-in REF column — no setup needed.
  2. To also store the Samply ID and participant code, add a "Device and Transmitted Variables" question on the FIRST page and declare the custom variables to read (their names must start with u, e.g. u_sid, u_code).
  3. Those values are then written to the dataset and appear in the export.
  4. Run a test interview and confirm REF (and the u_ columns) hold the transmitted values.
Example start link
https://www.soscisurvey.de/<project>/?r=%MESSAGE_ID%&u_sid=%SAMPLY_ID%&u_code=%PARTICIPANT_CODE%

2 · Register completion

A "PHP code" element placed alone on the final page calling redirect(url, false), which marks the interview FINISHED and redirects.

  1. Add a final questionnaire page containing ONLY a "PHP code" element (commands after redirect() are ignored).
  2. Build the redirect with SoSci's %reference% placeholder, which resolves to the stored REF value: redirect('https://samply.uni-konstanz.de/studies/<study-code>/done/%reference%', false);
  3. Keep the second argument false so SoSci marks the dataset complete before sending the participant to Samply.
  4. Test a full interview from a real Samply link and confirm it lands on /studies/<study-code>/done/<message-id>.
Example completion redirect
redirect('https://samply.uni-konstanz.de/studies/<study-code>/done/%reference%', false);

Or register completion silently with a POST

The redirect above navigates the participant's browser to Samply. The same completion can instead be registered server-to-server with an HTTP POST to /studies/<study-code>/done/<message-id> — no request body and no authentication (the message id in the path is the shared secret). Samply replies 200 on success or 400if the id matches no response, and it records the completion and cancels that send's pending reminders exactly like the redirect — just without redirecting. Whether SoSci Survey can issue that POST itself varies:

Supported natively
SoSci can POST it directly with the built-in sendPOST() function in a "PHP code" element — no redirect. Watch SoSci's outbound-request rate limits, which bite at ESM scale.
  1. Add a contentless page just before SoSci's final/goodbye page and place a "PHP code" element on it; an empty page auto-forwards after the PHP runs, so the real last page still sets FINISHED.
  2. Read the message id from the built-in REF variable with reference() — the value SoSci stored from ?r=%MESSAGE_ID% in the start link.
  3. Build the URL with the id in the path and POST with an empty body: $url = 'https://samply.uni-konstanz.de/studies/<study-code>/done/'.reference(); sendPOST($url, array());
  4. Do NOT call redirect() — sendPOST() returns inline and the participant continues to the last page. Optionally guard with if (strlen(reference()) == 15).
  5. Mind SoSci's outbound limits (~1000 requests/24h per project, 20 per interview, 2 per page; 5s timeout, no retry). A high-volume ESM study can hit the daily cap, where the redirect has none.
POST endpoint
POST https://samply.uni-konstanz.de/studies/<study-code>/done/<message-id>

POST sources: https://www.soscisurvey.de/help/doku.php/en:create:functions:sendjson · https://www.soscisurvey.de/help/doku.php/en:create:functions:reference · https://www.soscisurvey.de/help/doku.php/en:create:lastpage

Full request and response details are in the API reference.

Reserved parameters & gotchas

r is reserved (auto-stored in REF) — that is exactly what we use for the message id, and %reference% reads it back. Custom parameter names must start with u (e.g. u_sid). readGET() only reads on the first page.

Things to watch out for

  • If you instead capture the id into your own variable, inject it with PHP instead of %reference%, e.g. redirect('https://samply.uni-konstanz.de/studies/<study-code>/done/'.value('IV01'), false);
  • No SoSci plan/tier restriction applies — redirect() and URL-parameter capture are standard features.

Sources

These steps were verified against the platform's official documentation.