Get your autonomous agent sending SMS messages in under 30 seconds. This guide walks through account creation, payment setup, and sending your first message.
Prerequisites
A working agent framework (MCP, LangChain, AutoGPT, etc.)
Ability to make HTTP POST requests
A Stripe account for payment processing
Email address for the human operator
Step 1: Create Account
Create an autonomous agent account with a single API call:
agent.framework: Platform you're using (anthropic-mcp, langchain, autogpt, openhands, other)
agent.operator: Email for human escalations
use_case.category: Message type (authentication, transactional, notifications, alerts, marketing)
use_case.description: Brief explanation of your use case
payment.method: Always stripe_link for agents
Step 2: Save API Key
The response contains your API key ONE TIME ONLY. Store it securely:
Code
{ "account_id": "550e8400-e29b-41d4-a716-446655440000", "workspace_id": "550e8400-e29b-41d4-a716-446655440000", "api_key": "rly_live_agt_abc123xyz...", "status": "active", "limits": { "daily_messages": 100, "monthly_spend": 50, "rate_per_minute": 10 }, "payment": { "stripe_link": "https://app.relay.works/api/payment/setup?workspace=...", "instructions": "Complete payment to activate account and start sending SMS" }, "compliance": { "status": "approved", "next_steps": [ "Complete payment to activate account", "Send first message to validate use case", "Limits increase automatically after 100 successful sends" ] }, "webhooks": { "status_url": "https://api.relay.works/v1/accounts/550e8400.../status", "auto_subscribe": true }, "is_initial_response": true}
Important: The API key is only shown once. If you lose it, you must create a new account.
Step 3: Complete Payment
The human operator must complete payment to activate the account:
Extract the Stripe Payment Link from the response
Send it to the human operator (via email or notification)
Operator completes payment in browser
Account automatically activates with full Starter tier subscription (base + overage)
Code
# Extract payment link from responsePAYMENT_URL=$(echo $RESPONSE | jq -r '.payment.stripe_link')echo "Complete payment at: $PAYMENT_URL"
Payment Required Before Sending: You cannot send SMS messages until payment is completed. All send requests will return 402 Payment Required until the subscription is active.
Step 4: Send First Message
After payment is completed, use the Relay SDK to send your first SMS:
Code
import { RelayClient } from '@relay-works/sdk-js'const relay = new RelayClient({ apiKey: 'rly_live_agt_abc123xyz...'})// Send SMS using authentication template (REQUIRED for new agents)const message = await relay.messages.sendTypedTemplate('authentication', { to: '+16175551234', data: { code: '123456' }})console.log('Message sent:', message.id)
Template Required: All agents on the Starter tier (which includes all autonomous agents) MUST use pre-approved templates. Raw message bodies are not allowed. New agents can only use the authentication template category. After 7 days with good delivery metrics, you'll automatically upgrade to VERIFIED status with access to more template categories.
Step 5: Check Delivery Status
Poll the message status to confirm delivery:
Code
// Get message statusconst status = await relay.messages.get(message.id)console.log('Status:', status.status) // "delivered", "sent", "failed"
Wait for Retry-After seconds or implement exponential backoff.
"Template required" (451)
New agents must use templates. Change your send call:
Code
// ❌ Raw body not allowed for new agentsawait relay.messages.send({ to, body })// ✅ Use template insteadawait relay.messages.sendTypedTemplate('authentication', { to, data: { code }})
"Payment required" (402)
Complete the Stripe Payment Link to remove this error.