Service Signup & Login
Overview
The most common use case for Ravi: an agent signs up for a service, receives a verification code, and stores the credentials — all without human intervention.
Sign up for a service
# 1. Get your Identity details
EMAIL=$(ravi get email --json | jq -r '.email')
PHONE=$(ravi get phone --json | jq -r '.phone_number')
NAME=$(ravi identity list --json | jq -r '.[0].name')
# 2. Generate and store credentials
CREDS=$(ravi passwords create example.com --username "$EMAIL" --json)
PASSWORD=$(echo "$CREDS" | jq -r '.password')
# 3. Fill the signup form with $EMAIL, $PHONE, $NAME, and $PASSWORD
# (agent fills the form in the browser or via API)
# 4. Poll for SMS OTP (retry up to 10 times, 2s apart)
CODE=""
for i in $(seq 1 10); do
CODE=$(ravi inbox sms --unread --json | jq -r '.[0].preview // empty' | grep -oE '[0-9]{4,8}' | head -1)
[ -n "$CODE" ] && break
sleep 2
done
[ -z "$CODE" ] && echo "ERROR: SMS OTP not received after 20s" && exit 1
# 5. Or poll for email verification link
LINK=""
for i in $(seq 1 10); do
THREAD_ID=$(ravi inbox email --unread --json | jq -r '.[0].thread_id // empty')
if [ -n "$THREAD_ID" ]; then
LINK=$(ravi inbox email "$THREAD_ID" --json | jq -r '.messages[].text_content' | grep -oE 'https?://[^ ]+' | head -1)
[ -n "$LINK" ] && break
fi
sleep 2
done
[ -z "$LINK" ] && echo "ERROR: verification email not received after 20s" && exit 1
# 6. Complete verification with $CODE or $LINK
Log into a service
# 1. Find stored credentials
ENTRY=$(ravi passwords list --json | jq -r '.[] | select(.domain == "example.com")')
UUID=$(echo "$ENTRY" | jq -r '.uuid')
# 2. Get decrypted credentials
CREDS=$(ravi passwords get "$UUID" --json)
USERNAME=$(echo "$CREDS" | jq -r '.username')
PASSWORD=$(echo "$CREDS" | jq -r '.password')
# 3. Use $USERNAME and $PASSWORD to log in
Complete 2FA / OTP
After triggering 2FA on a service, poll for the code rather than using a fixed delay:
# Poll for SMS OTP (up to 10 retries, 2s apart = 20s timeout)
CODE=""
for i in $(seq 1 10); do
CODE=$(ravi inbox sms --unread --json | jq -r '.[0].preview // empty' | grep -oE '[0-9]{4,8}' | head -1)
[ -n "$CODE" ] && break
sleep 2
done
[ -z "$CODE" ] && echo "ERROR: OTP not received" && exit 1
# Or poll for email OTP
CODE=""
for i in $(seq 1 10); do
THREAD_ID=$(ravi inbox email --unread --json | jq -r '.[0].thread_id // empty')
if [ -n "$THREAD_ID" ]; then
CODE=$(ravi inbox email "$THREAD_ID" --json | jq -r '.messages[].text_content' | grep -oE '[0-9]{4,8}' | head -1)
[ -n "$CODE" ] && break
fi
sleep 2
done
[ -z "$CODE" ] && echo "ERROR: email OTP not received" && exit 1
# Enter $CODE to complete verification
Extract a verification link
Some services send a “click to verify” link instead of a code:
# Poll for verification email (up to 10 retries, 2s apart)
LINK=""
for i in $(seq 1 10); do
THREAD_ID=$(ravi inbox email --unread --json | jq -r '.[0].thread_id // empty')
if [ -n "$THREAD_ID" ]; then
LINK=$(ravi inbox email "$THREAD_ID" --json | jq -r '.messages[].text_content' | grep -oE 'https?://[^ ]+' | head -1)
[ -n "$LINK" ] && break
fi
sleep 2
done
Tips
- Use your Identity name for forms — when asked for a name, use
ravi identity list --json | jq -r '.[0].name'. Don’t use the account owner’s name. - Store credentials immediately — create a password entry during signup so you don’t lose the password.
- Poll, don’t sleep — SMS and email delivery takes 2–10 seconds. Use a retry loop (e.g. 10 × 2s) with an exit condition instead of a fixed
sleep. Fixed delays either fail intermittently or waste time. - Auto-generate passwords —
ravi passwords create <domain> --jsonauto-generates a strong password and returns it in the response.
Next steps
- Real-World Scenarios — software evaluation, price monitoring, travel booking
- Credential Vault — more on password management