testConnection()

Verifies project connectivity.

2 minPrerequisites: Client created

Problem: You want to verify your project key is valid and your API connection is working before you start tracking real responses.

Solution: Call testConnection() — it returns the project name on success, an error message on failure, and creates nothing in your Inbox.

Signature

typescript
testConnection(): Promise<
  | { ok: true; projectName: string }
  | { ok: false; error: string; code?: EnterestOSErrorCode }
>

Example

typescript
const result = await enterestos.testConnection();

if (result.ok) {
  console.log('Connected to:', result.projectName);
} else {
  console.error('Failed:', result.error);
}

Success

json
{ "ok": true, "projectName": "Demo Requests" }

Failure

json
{ "ok": false, "error": "Invalid project key" }

Result: You now know your connection is working and your project key is valid — nothing was written to your Inbox.

Common Questions

When should I call testConnection()?

During setup to verify your project key is correct. Once you have confirmed your integration works with a real test submission, you do not need it in production.