> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tracklysms.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing Your Integration

> Best practices for testing your Trackly SMS integration without a sandbox environment

Trackly SMS does not have a sandbox or test mode — all API calls send real messages. Use these practices to test safely and cost-effectively.

## Use Your Own Numbers

Send test messages to phone numbers you control. This lets you verify delivery, formatting, and opt-out handling without affecting real contacts.

```bash theme={null}
curl -X POST https://api.tracklysms.com/api/v2/send \
  -H "X-Api-Key: trk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+1YOUR_OWN_NUMBER",
    "list_number": "+18005551234",
    "body": "Test message from integration. Ref: {{messageId}}"
  }'
```

## Leverage the Free Tier

Every account includes 500 free messages per month. Use this allowance for integration testing before committing to paid volume.

## Create Dedicated Test API Keys

Generate a separate API key for testing in **Dashboard > Settings > API Keys**. Label it clearly (e.g., "Development - Test Only"). This makes it easy to:

* Revoke test keys without affecting production
* Track test usage separately in billing
* Prevent accidental production sends from development environments

## Test Opt-Out Flow

Verify that STOP keyword handling works correctly:

1. Send a test message to your own number
2. Reply with `STOP`
3. Confirm the contact is marked as unsubscribed in the dashboard
4. Attempt to send another message — it should be blocked
5. Reply with `START` to re-subscribe (if your account supports it)

## Test Webhooks

Use a webhook inspection tool to verify event delivery before building your handler:

1. Set up a temporary endpoint using a service like webhook.site or RequestBin
2. Configure the URL in **Dashboard > Settings > Webhooks**
3. Send a test message and verify you receive the delivery event
4. Check that the `X-Trackly-Signature` header is present

Then implement your handler and verify signature verification works:

```python theme={null}
import hmac
import hashlib

def verify_webhook(payload_body, signature_header, webhook_secret):
    expected = hmac.new(
        webhook_secret.encode(),
        payload_body,
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(f"sha256={expected}", signature_header)
```

## Test Bulk Operations

Start with small batches before scaling up:

1. **5 contacts** — verify the request format and response structure
2. **50 contacts** — check partial failure handling (include one invalid number)
3. **500 contacts** — validate performance and error handling at moderate scale

```python theme={null}
import requests

# Test with a small batch including one invalid number
response = requests.post(
    "https://api.tracklysms.com/api/v2/send/bulk",
    headers={"X-Api-Key": "trk_your_test_key"},
    json={
        "list_number": "+18005551234",
        "messages": [
            {"to": "+1YOUR_NUMBER", "body": "Test 1"},
            {"to": "invalid_number", "body": "Test 2"},  # Expect this to fail
        ]
    }
)

data = response.json()
print(f"Queued: {data['queued_count']}, Errors: {data['error_count']}")
print(f"Error details: {data.get('errors', [])}")
```

## Test Checklist

* [ ] Single message sends and receives successfully
* [ ] Bulk send handles partial failures correctly
* [ ] Webhook events are received and verified
* [ ] STOP keyword triggers unsubscribe
* [ ] Error responses are parsed and handled
* [ ] Transient error (5xx) retry logic works
* [ ] Link tracking redirects correctly (if using offers)
* [ ] Contact creation and journey enrollment works

## Next Steps

<CardGroup cols={2}>
  <Card title="Going to Production" icon="rocket" href="/guides/going-to-production">
    Launch your integration
  </Card>

  <Card title="Error Codes" icon="triangle-exclamation" href="/api-reference/v2/error-codes">
    Handle all error scenarios
  </Card>
</CardGroup>
