Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(sdk): qualify the pairing code and the 409 in the package docs

Yudhi Armyndharis677de12731e7
diff --git a/sdk/README.md b/sdk/README.md
index 9efa066b9..a029e36a8 100644
--- a/sdk/README.md
+++ b/sdk/README.md
@@ -88,7 +88,7 @@ const client = new OpenWAClient({
const session = await client.sessions.create({ name: 'my-session' });
await client.sessions.start(session.id);
-// Link the account before sending: scan sessions.getQrCode or use sessions.requestPairingCode,
+// Link the account before sending: scan sessions.getQrCode (or use sessions.requestPairingCode for a number with no linked session),
// then wait for status 'ready'. An unlinked session answers the send with 409.
const result = await client.messages.sendText(session.id, {
chatId: '[email protected]',
@@ -105,7 +105,7 @@ try {
await client.messages.sendText(/* … */);
} catch (e) {
if (e instanceof OpenWAConflictError) {
- /* session not ready, or a keyed send pending or unconfirmed (409) */
+ /* a conflicting state (409): typically a session not ready, or a keyed send pending or unconfirmed */
}
}
```
@@ -129,7 +129,7 @@ client = OpenWAClient(
session = client.sessions.create({"name": "my-session"})
client.sessions.start(session["id"])
-# Link the account before sending: scan sessions.get_qr_code or use sessions.request_pairing_code,
+# Link the account before sending: scan sessions.get_qr_code (or use sessions.request_pairing_code for a number with no linked session),
# then wait for status "ready". An unlinked session answers the send with 409.
result = client.messages.send_text(session["id"], {
"chatId": "[email protected]",
@@ -158,7 +158,7 @@ $client = new Client([
$session = $client->sessions->create(['name' => 'my-session']);
$client->sessions->start($session['id']);
-// Link the account before sending: scan sessions->getQrCode or use sessions->requestPairingCode,
+// Link the account before sending: scan sessions->getQrCode (or use sessions->requestPairingCode for a number with no linked session),
// then wait for status 'ready'. An unlinked session answers the send with 409.
$result = $client->messages->sendText($session['id'], [
'chatId' => '[email protected]',
@@ -191,7 +191,7 @@ OpenWAClient client = new OpenWAClient("http://localhost:2785", "owa_k1_…");
SessionResponse session = client.sessions.create(CreateSessionRequest.builder().name("my-session").build());
client.sessions.start(session.id());
-// Link the account before sending: scan sessions.getQrCode or use sessions.requestPairingCode,
+// Link the account before sending: scan sessions.getQrCode (or use sessions.requestPairingCode for a number with no linked session),
// then wait for status READY. An unlinked session answers the send with 409.
MessageResponse result = client.messages.sendText(session.id(),
SendTextRequest.builder()
@@ -234,7 +234,7 @@ if err != nil {
if _, err := client.Sessions.Start(ctx, session.ID); err != nil {
log.Fatal(err)
}
-// Link the account before sending: scan Sessions.QRCode or use Sessions.RequestPairingCode,
+// Link the account before sending: scan Sessions.QRCode (or use Sessions.RequestPairingCode for a number with no linked session),
// then wait for status "ready". An unlinked session answers the send with 409.
res, err := client.Messages.SendText(ctx, session.ID, openwa.SendTextRequest{
ChatID: "[email protected]",
diff --git a/sdk/go/client.go b/sdk/go/client.go
index fce72f0ab..abe482d1b 100644
--- a/sdk/go/client.go
+++ b/sdk/go/client.go
@@ -18,7 +18,7 @@
// if _, err := client.Sessions.Start(ctx, session.ID); err != nil {
// log.Fatal(err)
// }
-// // Link the account before sending: scan Sessions.QRCode or use Sessions.RequestPairingCode,
+// // Link the account before sending: scan Sessions.QRCode (or use Sessions.RequestPairingCode for a number with no linked session),
// // then wait for status "ready". An unlinked session answers the send with 409.
// res, err := client.Messages.SendText(ctx, session.ID, openwa.SendTextRequest{
// ChatID: "[email protected]",
diff --git a/sdk/go/errors.go b/sdk/go/errors.go
index 192f7ab1d..c782baa98 100644
--- a/sdk/go/errors.go
+++ b/sdk/go/errors.go
@@ -29,8 +29,8 @@ var (
ErrForbidden = errors.New("openwa: forbidden")
// ErrNotFound is returned for a 404.
ErrNotFound = errors.New("openwa: not found")
- // ErrConflict is returned for a 409: the session is not ready for the operation, or a keyed send is
- // pending or may already have been sent (see the error code).
+ // ErrConflict is returned for a 409: a conflicting state, typically a session that is not ready for the
+ // operation, or a keyed send that is pending or may already have been sent (see the error code).
ErrConflict = errors.New("openwa: conflict")
// ErrRateLimited is returned for a 429 (too many requests). The global rate
// limiter's 429 lifts when its window expires (seconds for the per-second
diff --git a/sdk/go/example_test.go b/sdk/go/example_test.go
index 2e01c9d14..374f4df16 100644
--- a/sdk/go/example_test.go
+++ b/sdk/go/example_test.go
@@ -27,7 +27,7 @@ func ExampleNew() {
log.Fatal(err)
}
- // Link the account before sending: scan Sessions.QRCode or use Sessions.RequestPairingCode,
+ // Link the account before sending: scan Sessions.QRCode (or use Sessions.RequestPairingCode for a number with no linked session),
// then wait for status "ready". An unlinked session answers the send with 409.
res, err := client.Messages.SendText(ctx, session.ID, openwa.SendTextRequest{
ChatID: "[email protected]",
diff --git a/sdk/java/README.md b/sdk/java/README.md
index 663769f9a..88cf481aa 100644
--- a/sdk/java/README.md
+++ b/sdk/java/README.md
@@ -108,7 +108,7 @@ import com.rmyndharis.openwa.errors.OpenWANotFoundError;
try {
client.messages.sendText(sessionId, body);
} catch (OpenWAConflictError e) {
- // 409 — engine not ready, or a keyed send that is pending or uncertain:
+ // 409 — a conflicting state: typically the engine is not ready, or a keyed send is pending or uncertain;
// e.code() tells them apart (see Send idempotency)
} catch (OpenWANotFoundError e) {
// 404 — session or chat not found
diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/errors/OpenWAConflictError.java b/sdk/java/src/main/java/com/rmyndharis/openwa/errors/OpenWAConflictError.java
index 8087ce7a7..abaa37b78 100644
--- a/sdk/java/src/main/java/com/rmyndharis/openwa/errors/OpenWAConflictError.java
+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/errors/OpenWAConflictError.java
@@ -3,7 +3,7 @@ package com.rmyndharis.openwa.errors;
import java.util.List;
import java.util.Map;
-/** 409 Conflict: the session is not ready for the operation, or a keyed send is pending or may already have been sent (see {@code code()}). */
+/** 409 Conflict: a conflicting state, typically a session that is not ready for the operation, or a keyed send that is pending or may already have been sent (see {@code code()}). */
public class OpenWAConflictError extends OpenWAApiError {
public OpenWAConflictError(String message, int status, Object body, String errorKind) {
super(message, status, body, errorKind);
diff --git a/sdk/javascript/src/client.ts b/sdk/javascript/src/client.ts
index ef76a634a..3020c99de 100644
--- a/sdk/javascript/src/client.ts
+++ b/sdk/javascript/src/client.ts
@@ -16,7 +16,7 @@
* // Sessions are addressed by the UUID that create() returns, not by name.
* const session = await client.sessions.create({ name: 'my-session' });
* await client.sessions.start(session.id);
- * // Link the account before sending: scan sessions.getQrCode or use sessions.requestPairingCode,
+ * // Link the account before sending: scan sessions.getQrCode (or use sessions.requestPairingCode for a number with no linked session),
* // then wait for status 'ready'. An unlinked session answers the send with 409.
* await client.messages.sendText(session.id, {
* chatId: '[email protected]',
diff --git a/sdk/javascript/src/errors.ts b/sdk/javascript/src/errors.ts
index dcf736374..4f2132a36 100644
--- a/sdk/javascript/src/errors.ts
+++ b/sdk/javascript/src/errors.ts
@@ -95,7 +95,7 @@ export class OpenWAAuthError extends OpenWAApiError {}
export class OpenWAForbiddenError extends OpenWAApiError {}
/** 404 Not Found. */
export class OpenWANotFoundError extends OpenWAApiError {}
-/** 409 Conflict: the session is not ready for the operation, or a keyed send is pending or may already have been sent (see `code`). */
+/** 409 Conflict: a conflicting state, typically a session that is not ready for the operation, or a keyed send that is pending or may already have been sent (see `code`). */
export class OpenWAConflictError extends OpenWAApiError {}
/**
* 429 Too Many Requests: rate limited. The global rate limiter's 429 lifts when its window
diff --git a/sdk/javascript/src/index.ts b/sdk/javascript/src/index.ts
index 19af62788..af89d898d 100644
--- a/sdk/javascript/src/index.ts
+++ b/sdk/javascript/src/index.ts
@@ -15,7 +15,7 @@
* // Sessions are addressed by the UUID that create() returns, not by name.
* const session = await client.sessions.create({ name: 'my-session' });
* await client.sessions.start(session.id);
- * // Link the account before sending: scan sessions.getQrCode or use sessions.requestPairingCode,
+ * // Link the account before sending: scan sessions.getQrCode (or use sessions.requestPairingCode for a number with no linked session),
* // then wait for status 'ready'. An unlinked session answers the send with 409.
* const result = await client.messages.sendText(session.id, {
* chatId: '[email protected]',
diff --git a/sdk/php/src/Exceptions/OpenWAConflictException.php b/sdk/php/src/Exceptions/OpenWAConflictException.php
index 352821cac..50200f2f6 100644
--- a/sdk/php/src/Exceptions/OpenWAConflictException.php
+++ b/sdk/php/src/Exceptions/OpenWAConflictException.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace OpenWA\Exceptions;
-/** 409 Conflict: the session is not ready for the operation, or a keyed send is pending or may already have been sent (see getErrorCode()). */
+/** 409 Conflict: a conflicting state, typically a session that is not ready for the operation, or a keyed send that is pending or may already have been sent (see getErrorCode()). */
class OpenWAConflictException extends OpenWAApiException
{
}
diff --git a/sdk/python/openwa/__init__.py b/sdk/python/openwa/__init__.py
index 52a1475d6..5d36eb59e 100644
--- a/sdk/python/openwa/__init__.py
+++ b/sdk/python/openwa/__init__.py
@@ -15,7 +15,7 @@ Example usage::
# Sessions are addressed by the UUID that create() returns, not by name.
session = client.sessions.create({"name": "my-session"})
client.sessions.start(session["id"])
- # Link the account before sending: scan sessions.get_qr_code or use sessions.request_pairing_code,
+ # Link the account before sending: scan sessions.get_qr_code (or use sessions.request_pairing_code for a number with no linked session),
# then wait for status "ready". An unlinked session answers the send with 409.
result = client.messages.send_text(session["id"], {
"chatId": "[email protected]",
diff --git a/sdk/python/openwa/errors.py b/sdk/python/openwa/errors.py
index f028e7e43..21e02b84a 100644
--- a/sdk/python/openwa/errors.py
+++ b/sdk/python/openwa/errors.py
@@ -106,7 +106,7 @@ class OpenWANotFoundError(OpenWAApiError):
class OpenWAConflictError(OpenWAApiError):
- """409 Conflict: the session is not ready for the operation, or a keyed send is pending or may already have been sent (see ``code``)."""
+ """409 Conflict: a conflicting state, typically a session that is not ready for the operation, or a keyed send that is pending or may already have been sent (see ``code``)."""
class OpenWARateLimitError(OpenWAApiError):