---
name: formbricks-question-addition
description: Skill for adding questions to Formbricks surveys through browser automation when API calls fail
---

# Formbricks Question Addition via Browser Automation

## When to Use
Use this skill when:
- Formbricks Management API authentication works but question creation fails with 400 errors
- API endpoints return 404 errors
- You need to create Link Survey type questionnaires with multiple required questions
- Manual browser interaction is needed as fallback to API automation

## Prerequisites
- Formbricks instance URL and login credentials
- API Key (for authentication testing)
- Browser automation tools available

## Step-by-Step Process

### 1. API Authentication Test
```python
# Test Management API endpoint
import requests
headers = {'x-api-key': 'your_api_key'}
response = requests.get('https://form.140103.xyz/api/management/surveys', headers=headers)
```

### 2. Login via Browser
- Navigate to Formbricks instance URL
- Login with email and password credentials
- Verify successful login by checking for survey editor interface

### 3. Create New Survey
- Click "New survey" button
- Select "Start from scratch" option
- Change survey title to desired name
- Save draft

### 4. Navigate to Questions Tab
- Click "Questions" tab in navigation
- Wait for question editor to load
- Verify you're in question editing mode

### 5. Add Required Questions
For each question:
- Click "Add Question" button
- Select appropriate question type:
  - Name: openText with inputType: text
  - Company Name: openText with inputType: text  
  - Email: email type (auto-validates format)
  - Phone Number: openText with inputType: phone
  - Remarks: openText with inputType: textarea
- Set question as required using toggle switch
- Add placeholder text if needed
- Save each question

### 6. Configure Survey Settings
- Navigate to "Settings" tab
- Set Survey Type to "Link Survey"
- Configure welcome and ending pages
- Set visibility options

### 7. Publish and Get Link
- Click "Publish" button
- Wait for publishing confirmation
- Copy and save the share link

## Common Issues & Solutions

### API Authentication Works but Question Creation Fails
- **Cause**: API expects strict question format
- **Solution**: Use browser automation as fallback

### Browser Navigation Issues
- **Cause**: Page redirects to styling settings instead of questions
- **Solution**: Manually click "Questions" tab after each navigation

### Question Type Selection Problems
- **Cause**: Some question types not available in browser UI
- **Solution**: Use closest available type (e.g., openText for phone)

### Survey Type Not Configurable
- **Cause**: Settings tab may not show Survey Type option
- **Solution**: Check for hidden settings or use default type

## Verification Steps
- [ ] Survey created successfully
- [ ] All 5 required questions added
- [ ] Survey Type configured correctly
- [ ] Welcome and ending pages set
- [ ] Share link obtained and working

## Performance Notes
- Browser automation may be slower than API calls
- Multiple page refreshes may be needed
- Manual verification of each step recommended

## Alternative Approaches
- If both API and browser fail, consider:
  1. Contacting Formbricks support
  2. Checking instance configuration
  3. Using different browser or device
  4. Verifying API permissions and endpoints
- Survey already created and in edit mode
- Browser automation tools available

## Steps

### 1. Navigate to Survey Edit Page
```
browser_navigate(url="https://form.140103.xyz/environments/{env_id}/surveys/{survey_id}/edit")
```

### 2. Click Questions Tab
```
browser_click(ref="e6")  # Questions tab
```

### 3. Add First Question
```
browser_click(ref="e20")  # Add Question button
```

### 4. Handle Interface Switching
**If interface switches to Styling mode:**
```
# Navigate back to Questions
browser_click(ref="e6")
# Try adding question again
browser_click(ref="e20")
```

### 5. Input Question Details
```
browser_type(ref="e13", text="Question text")
# Set question type if needed
# Set required flag if needed
```

### 6. Repeat for Additional Questions
- Use the same pattern for each question
- Save frequently to avoid data loss

### 7. Save and Publish
```
browser_click(ref="e3")  # Save button
# browser_click(ref="e4")  # Publish button
```

## Common Issues & Workarounds

### Issue: Interface Switches to Styling Mode
**Solution:** Immediately click back to Questions tab and retry Add Question button. This is a known Formbricks interface quirk.

### Issue: Add Question Button Not Responding
**Solution:** Refresh the page and repeat the navigation steps. Sometimes the interface needs a full reload.

### Issue: Navigation Errors
**Solution:** Use browser_back() to return to previous page if navigation fails, then retry the current step.

### Issue: Elements Not Found
**Solution:** Take a fresh snapshot with browser_snapshot() and verify the current element references before retrying.

## Verification Steps
1. After adding each question, verify it appears in the preview
2. Check that required flags are set correctly
3. Ensure question types are correct (text, email, date, etc.)
4. Test the survey flow before publishing

## Best Practices
- Save frequently to avoid losing progress
- Take snapshots when encountering unexpected behavior
- Be patient with interface switching - it's a known issue
- Consider adding questions in batches rather than all at once
- Test the final survey thoroughly before sharing

## Notes
This skill addresses a specific Formbricks interface issue where the editor unexpectedly switches between Questions and Styling modes. The workaround is to simply navigate back to Questions and retry the action.