Skip to content

register-with-whatsapp ​

Method: POST
Path: /auth/register/whatsapp

Tags: Auth

Summary ​

Register with WhatsApp

Description ​

Registers a new user with their WhatsApp number. Returns a User object with access_token and refresh_token.

Storefront SDK Usage ​

SDK Method: sdk.auth.registerWithWhatsapp()

Example:

typescript
// Register a new user with WhatsApp number
const { data, error } = await sdk.auth.registerWithWhatsapp({
  phone: "9876543210",
  country_code: "+91",
  first_name: "John",
  last_name: "Doe",
  email: "john.doe@example.com"
});

if (error) {
  console.error("WhatsApp registration failed:", error.message);
} else {
  console.log("OTP token:", data.otp_token);
  console.log("Action:", data.otp_action);
}

TypeScript Definition ​

typescript
"register-with-whatsapp": {
        parameters: {
            query?: never;
            header?: {
                /** @description This param is used to enable debug mode. If debug mode is enabled, the API will return OTP as well. This is only for development and testing purposes. */
                "x-debug-mode"?: components["parameters"]["DebugMode"];
            };
            path?: never;
            cookie?: never;
        };
        requestBody: {
            content: {
                "application/json": {
                    /**
                     * @description Two-letter code begin with a plus sign prefix that identifies different countries. By default it will be +91 if not provided.
                     * @constant
                     */
                    country_code?: "+91";
                    /** @description 10 digit WhatsApp number without country code. */
                    phone: string;
                    first_name: string;
                    last_name?: string | null;
                    /** Format: email */
                    email?: string | null;
                };
            };
        };
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message: string;
                        success: boolean;
                        content: components["schemas"]["OtpContent"];
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
        };
    };

Component References ​

ReferenceResolves To
components["parameters"]["DebugMode"]DebugMode
components["schemas"]["OtpContent"]OtpContent
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized

Parameters ​

  • x-debug-mode (header): This param is used to enable debug mode. If debug mode is enabled, the API will return OTP as well. This is only for development and testing purposes.

Request Body ​

Content Types: application/json

Responses ​

200 ​

OK

400 ​

Bad request

401 ​

Not authorized for given operation on the Resource

OpenAPI Definition ​

json
{
  "tags": [
    "Auth"
  ],
  "operationId": "register-with-whatsapp",
  "summary": "Register with WhatsApp",
  "description": "Registers a new user with their WhatsApp number. Returns a `User` object with `access_token` and `refresh_token`.",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/register-with-whatsapp",
    "description": "API reference for the register-with-whatsapp operation"
  },
  "parameters": [
    {
      "$ref": "#/components/parameters/DebugMode"
    }
  ],
  "requestBody": {
    "description": "",
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "phone",
            "first_name"
          ],
          "properties": {
            "country_code": {
              "description": "Two-letter code begin with a plus sign prefix that identifies different countries. By default it will be +91 if not provided.",
              "type": [
                "string",
                "null"
              ],
              "const": "+91"
            },
            "phone": {
              "description": "10 digit WhatsApp number without country code.",
              "type": "string",
              "maxLength": 10,
              "minLength": 10,
              "pattern": "^[0-9]{10}$"
            },
            "first_name": {
              "type": "string"
            },
            "last_name": {
              "type": [
                "string",
                "null"
              ]
            },
            "email": {
              "type": [
                "string",
                "null"
              ],
              "format": "email"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "message",
              "success",
              "content"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "$ref": "#/components/schemas/OtpContent"
              }
            }
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "auth",
  "x-speakeasy-ignore": true,
  "x-speakeasy-name-override": "registerWithWhatsapp"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: