ChottuLink deep links
Create a ChottuLink dynamic deep link from your server.
Create a deep link
Call createChottuLink(input) to generate a dynamic deep link. It resolves to the finished link.
Only destinationUrl is required. A destinationUrl without a scheme gets https:// added for you.
Server-only. This uses your secret API key, so never import @bdk/native/server/chottulink into a browser bundle.
Set credentials
Pass apiKey and domain directly, or set them as environment variables. Use env vars in production to keep secrets out of code.
The key is read from BDK_CHOTTULINK_API_KEY, then CHOTTULINK_API_KEY. The domain is read from BDK_CHOTTULINK_DOMAIN, then CHOTTULINK_DOMAIN, then CHOTTULINK_LINK_DOMAIN. An explicit value always wins over the environment.
The API key is a secret. Never ship it to the browser or commit it to source control.
Input options
Every field you can pass to createChottuLink. Only destinationUrl is required; apiKey and domain are required either here or via the environment.
destinationUrl: string— where the link resolves to. Getshttps://added if no scheme is present.apiKey?: string— ChottuLink API key. Falls back to env vars.domain?: string— the link domain. Falls back to env vars; protocol and trailing slashes are stripped.linkName?: string— a human-readable name. Defaults toselectedPath, then to"BDK Native Deeplink".selectedPath?: string— custom path segment; a leading/is removed and the value trimmed.iosBehavior?: 1 | 2— iOS open behavior. Defaults to2.androidBehavior?: 1 | 2— Android open behavior. Defaults to2.utm?: ChottuLinkUtm— UTM attribution (source,medium,campaign,term,content), all optional.social?: ChottuLinkSocial— social preview (title,description,imageUrl), all optional.urlParams?: Record<string, string | number | boolean | undefined | null>— query params appended ontodestinationUrl(empty/null/undefined values are skipped).extraParams?: Record<string, unknown>— raw fields merged into the request body for options not modeled here.baseUrl?: string— override the API base. Defaults tohttps://api2.chottulink.com/chotuCore/pa/v1.fetch?: FetchLike— a customfetch(for testing or non-Node runtimes).
Read the result
The resolved value is a ChottuLinkResult with three fields:
dynamicLink: string | null— the generated link (the API'sshort_url, falling back tolong_url), ornull.errorMessage: string | null— an error message from the API response, ornull.raw: unknown— the full, unmodified parsed response.
Check dynamicLink for null and inspect errorMessage before using the link.
Handle errors
createChottuLink throws a BdkError (importable from @bdk/native) when a required field is missing (BDK_VALIDATION_ERROR) or the request fails (BDK_PROVIDER_ERROR). For failed requests, details carries the HTTP status and response body.
A transport or validation failure throws; an application error inside a successful response surfaces as result.errorMessage instead.