What you’ll build
- Check if your study is accepting responses before showing the prompt
- Open the interview in a new tab when the user clicks
- Receive a webhook when the interview completes
- Fetch the transcript via API
- Mark the user in your database so the prompt doesn’t appear again
Prerequisites
- A userjourneys.ai account with an active study
- An API key
- A server that can receive HTTPS POST requests (for the webhook)
Step 1: Configure the webhook
Set up a webhook so userjourneys.ai notifies your server when an interview completes. You only need to do this once per project.signing_secret — save it. You’ll need it to verify incoming webhooks.
Step 2: Check study capacity
Before showing the prompt, verify that the study can accept responses. This prevents showing a prompt that leads to a closed study.Step 3: Show the prompt and open the interview
On your frontend, show a prompt to users who haven’t completed the interview yet. When they click, open the interview link in a new tab.interview_link comes from the study object you fetched in Step 2. It looks like https://app.userjourneys.ai/i/xK9mR2pQ.
Appending ?reference_id= to the link passes the user’s identity through to the webhook payload. This is how you match a completed interview back to the user who clicked — even if multiple users are interviewing at the same time. You can pass any identifier: a user ID, email, UUID, or whatever your system uses.
Step 4: Handle the webhook and fetch the transcript
When a user finishes the interview, userjourneys.ai sends a POST request to your webhook URL. Verify the signature, fetch the transcript, then update your database.What the payload looks like
Step 5: Stop showing the prompt
Once your database is updated, the check from Step 3 handles the rest —user.interview_completed is now true, so the prompt won’t appear again.
That’s it. The full flow:
- User sees the prompt -> clicks -> interview opens in a new tab
- User completes the interview -> userjourneys.ai sends a webhook
- Your server verifies the signature -> fetches the transcript -> marks the user as completed
- Next time the user loads the page -> no prompt