Scripts and CI - Momentic
Start a session
Use the qa CLI from a script or continuous integration (CI) job after your target is ready. Set MOMENTIC_API_KEY as a CI secret instead of running qa login. Start a session with qa start and save its ID and URL. Use qa wait to wait for completion or a question, then qa report to export findings. A successful wait means Mo finished testing. Check the report to see whether the app met your criteria. You can also start a web session over HTTP with a Momentic API key. This request returns sessionId and webUrl:
curl --fail-with-body https://api.momentic.ai/v1/mo/sessions \
-H "Authorization: Bearer $MOMENTIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message":"Test checkout on https://preview.example.com. Do not submit payment or place an order."}'
Start a PR session
Send the provider and PR reference to /v1/mo/pr-sessions. GitHub is the supported PR provider. previewUrl is optional; supply it when your script or coding agent knows which deployment to test:
curl --fail-with-body https://api.momentic.ai/v1/mo/pr-sessions \
-H "Authorization: Bearer $MOMENTIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "Test the PR changes. Do not submit payment.",
"pullRequest": {
"provider": "github",
"kind": "number",
"owner": "acme",
"repo": "shop",
"number": 412
},
"previewUrl": "https://preview.example.com"
}'
A selected environment needs no preview URL. Otherwise, discovery is best effort: missing or ambiguous previews do not block startup. Mo can inspect the PR or ask you for the target. Supply previewUrl when you know the deployment. For recurring testing, configure a Mo schedule with a prompt and environment. Each scheduled run starts a new session. Use an exported report to read results from your scripts. See Mo integrations for other connections.