login-pos-device-with-whatsapp
Method: POST
Path: /pos/auth/login/whatsapp
Tags: POS
Summary
Login with whatsapp
Description
Login to POS device using whatsapp. Login to POS device using phone. The endpoint requires authentication with an API key that has the scope set to 'storefront' for a particular store, ensuring secure access for user login operation.
Pos SDK Usage
SDK Method: pos.loginWithWhatsapp()
Example:
typescript
const { data, error } = await pos.loginWithWhatsapp({
location_id: "pos-location-123",
phone: "234567890",
country_code: "+91" // default is +91
});
if (error) {
console.error("WhatsApp login failed:", error.message);
} else {
console.log("WhatsApp OTP sent:", data.otp_token);
console.log("Action:", data.otp_action);
// Use the otp_token to verify OTP
}TypeScript Definition
typescript
"login-pos-device-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": {
location_id: string;
/** @description 10 digit phone number without country code linked with WhatsApp. */
phone: string;
/**
* @description Two-letter code begin with a plus sign prefix that identifies different countries. By default it will be +91 if not provided.
* @default +91
*/
country_code?: string;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
otp_token: string;
/** @constant */
otp_action: "login";
};
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["parameters"]["DebugMode"] | DebugMode |
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": [
"POS"
],
"operationId": "login-pos-device-with-whatsapp",
"summary": "Login with whatsapp",
"description": "Login to POS device using whatsapp. Login to POS device using phone. The endpoint requires authentication with an API key that has the scope set to 'storefront' for a particular store, ensuring secure access for user login operation.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/login-pos-device-with-whatsapp",
"description": "API reference for the login-pos-device-with-whatsapp operation"
},
"parameters": [
{
"$ref": "#/components/parameters/DebugMode"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"location_id",
"phone"
],
"properties": {
"location_id": {
"type": "string"
},
"phone": {
"description": "10 digit phone number without country code linked with WhatsApp.",
"type": "string"
},
"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",
"default": "+91"
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"otp_token": {
"type": "string"
},
"otp_action": {
"type": "string",
"const": "login"
}
},
"required": [
"otp_token",
"otp_action"
],
"type": "object"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
},
"security": [
{
"X-Api-Key": []
}
],
"x-speakeasy-group": "pos",
"x-speakeasy-ignore": true,
"x-speakeasy-name-override": "loginWithWhatsapp"
}Auto-generated from OpenAPI spec and TypeScript definitions