whatsapp-embedded-signup
v1.0.1
Published
React component for WhatsApp Business Platform embedded signup flow
Downloads
6
Maintainers
Readme
WhatsApp Embedded Signup
A React component for implementing WhatsApp Business Platform's embedded signup flow.
Installation
npm install whatsapp-embedded-signup
# or
yarn add whatsapp-embedded-signupUsage
import React from "react";
import WhatsAppSignup from "whatsapp-embedded-signup";
function App() {
const handleSuccess = (code, response) => {
console.log("Signup successful!", { code, response });
// Handle successful signup
};
const handleError = (error) => {
console.error("Signup error:", error);
// Handle signup error
};
return (
<WhatsAppSignup
appId="your_facebook_app_id"
configId="your_config_id"
pixelId="your_pixel_id" // Optional
onSuccess={handleSuccess}
onError={handleError}
>
{({ launchWhatsAppSignup }) => (
<button onClick={launchWhatsAppSignup}>
Sign up for WhatsApp Business
</button>
)}
</WhatsAppSignup>
);
}Props
| Prop | Type | Required | Default | Description |
| --------- | -------- | -------- | --------------------- | --------------------------------------------------------- |
| appId | string | No | "your_app_id_here" | Your Facebook App ID |
| configId | string | No | "your_config_id_here" | Your WhatsApp config ID |
| pixelId | string | No | "your-pixel-id-here" | Your Facebook Pixel ID for tracking |
| onSuccess | function | No | Console log | Callback when signup is successful |
| onError | function | No | Console error | Callback when signup fails |
| children | function | Yes | - | Render prop function that receives launchWhatsAppSignup |
License
MIT
