Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(sdk): link the session before the quickstart send

Yudhi Armyndharis40ad8a985a4e
diff --git a/sdk/README.md b/sdk/README.md
index 39247b1f4..b61e46c4c 100644
--- a/sdk/README.md
+++ b/sdk/README.md
@@ -100,6 +100,8 @@ 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,
+// then wait for status 'ready'. An unlinked session answers the send with 409.
const result = await client.messages.sendText(session.id, {
chatId: '[email protected]',
text: 'Hello from the OpenWA SDK!',
@@ -139,6 +141,8 @@ 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,
+# then wait for status "ready". An unlinked session answers the send with 409.
result = client.messages.send_text(session["id"], {
"chatId": "[email protected]",
"text": "Hello from the OpenWA Python SDK!",
@@ -166,6 +170,8 @@ $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,
+// then wait for status 'ready'. An unlinked session answers the send with 409.
$result = $client->messages->sendText($session['id'], [
'chatId' => '[email protected]',
'text' => 'Hello from the OpenWA PHP SDK!',
@@ -197,6 +203,8 @@ 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,
+// then wait for status READY. An unlinked session answers the send with 409.
MessageResponse result = client.messages.sendText(session.id(),
SendTextRequest.builder()
.chatId("[email protected]")
@@ -235,11 +243,18 @@ session, err := client.Sessions.Create(ctx, openwa.CreateSessionRequest{Name: "m
if err != nil {
log.Fatal(err)
}
-client.Sessions.Start(ctx, session.ID)
+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,
+// 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]",
Text: "Hello from the OpenWA Go SDK!",
})
+if err != nil {
+ log.Fatal(err)
+}
fmt.Println(res.MessageID)
```