Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

chore(sdk): gate the Go SDK in CI and changelog it (#761)

Yudhi Armyndharisd56f476fdc8d
diff --git a/.github/workflows/sdk-ci.yml b/.github/workflows/sdk-ci.yml
index c364e17f0..d52d13ac4 100644
--- a/.github/workflows/sdk-ci.yml
+++ b/.github/workflows/sdk-ci.yml
@@ -28,6 +28,9 @@ jobs:
cache-dependency-path: sdk/javascript/package-lock.json
- run: npm ci
- run: npm test
+ # The build tsconfigs exclude test/, and vitest strips types without checking them, so the
+ # type-level wire contract in test/*.test-d.ts only gates if tsc runs over test/ too (#754).
+ - run: npm run typecheck
- run: npm run build
- run: npm run smoke # dual CJS+ESM consumable — must run after build
@@ -73,3 +76,25 @@ jobs:
java-version: '17'
cache: maven
- run: mvn -B verify
+
+ go:
+ name: Go SDK
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: sdk/go
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-go@v5
+ with:
+ go-version: '1.22' # the go.mod minimum, so CI gates what the SDK claims to support
+ cache: false # stdlib-only, no go.sum to cache
+ - name: gofmt
+ run: |
+ if [ -n "$(gofmt -l .)" ]; then
+ echo 'Unformatted files:'
+ gofmt -l .
+ exit 1
+ fi
+ - run: go vet ./...
+ - run: go test -race ./...
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 77be3e072..858b98e07 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
+- **Official Go SDK (`sdk/go`).** Hand-written, stdlib-only (no third-party dependencies) Go client
+ covering the user-facing API surface, joining the JavaScript/Python/PHP/Java clients. Entry point is
+ `openwa.New(baseURL, apiKey, opts...)`, which returns a concurrency-safe `*Client` whose exported
+ fields group the API by domain (`Sessions`, `Messages`, `Contacts`, `Groups`, `Webhooks`, `Chats`,
+ `Status`, `Labels`, `Channels`, `Catalog`, `Templates`, `Health`, `Search`, `Auth`). Every network
+ method is context-first; configuration and dependency injection go through functional options
+ (`WithHTTPClient`, `WithTransport`, `WithLogger`, `WithRetry`, `WithMiddleware`, `WithTimeout`,
+ `WithUserAgent`, `WithHeader`, `WithInsecureHTTP`). Errors are typed: match the sentinels with
+ `errors.Is` (`ErrBadRequest`, `ErrUnauthorized`, `ErrForbidden`, `ErrNotFound`, `ErrConflict`,
+ `ErrRateLimited`, `ErrNotImplemented`) or unwrap the concrete `*APIError` with `errors.As`. Retries
+ are opt-in (`WithRetry`), honour `Retry-After`, rewind request bodies via `GetBody`, and are skipped
+ for non-idempotent methods on network errors so a dropped connection cannot replay a send. Redirects
+ are never followed, so the bearer-equivalent `X-API-Key` is never re-sent to a redirect target. A
+ `TestRouting` table asserts the exact method and path of every service call, and the suite runs in CI
+ (`gofmt`/`go vet`/`go test -race`) on both SDK and server-contract changes, so route drift fails at
+ test time. Requires Go 1.22+. Thanks @Revelts.
+
### Changed
### Fixed