Observed since 20 Oct, 19:26 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
360dialog-connect-button
React component to trigger and consume the 360dialog Partner Integrated Onboarding process, as well as the 360dialog Permission Page.
This package provides a button component to quickly integrate the 360dialog Partner Integrated Onboarding process into your application. It supports React.js as an importable component and Vanilla JavaScript / plain HTML via a CDN-hosted web component (<dialog-connect-button>), so you can use it on any website without a build step. To learn more about this process and how to participate in this as a 360dialog Partner, please visit our documentation or contact your account manager. If you want to become a 360dialog Partner in order to enable your clients to use the WhatsApp Business API, please get in touch with us.
In order to access the 360dialog Partner Integrated Onboarding process you need to set your partner_redirect_url via the Partner API. This will be used to redirect the client after the onboarding process is finished. Important: To use the ConnectButton component the redirect URL needs to match the route, that has the button integrated.
yarn add 360dialog-connect-button
npm install 360dialog-connect-button
Add the connect button to your React app:
import { ConnectButton } from '360dialog-connect-button';
const App = () => {
const handleCallback = callbackObject => {
/* The callback function returns the client ID as well as all channel IDs, for which you're enabled to fetch the API key via the Partner API */
console.log('client ID: ' + callbackObject.client);
console.log('channel IDs: ' + callbackObject.channels);
};
return (
<div>
<ConnectButton partnerId={'your-partner-id'} callback={handleCallback} />
</div>
);
};
You can also use the connect button on any website without React or npm! Simply include the script from a CDN and use the <dialog-connect-button> HTML element.
<!-- From unpkg -->
<script src="https://unpkg.com/360dialog-connect-button/dist/dialog-connect-button.umd.js"></script>
<!-- From jsdelivr -->
<script src="https://cdn.jsdelivr.net/npm/360dialog-connect-button/dist/dialog-connect-button.umd.js"></script>
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/360dialog-connect-button/dist/dialog-connect-button.umd.js"></script>
</head>
<body>
<dialog-connect-button
partner-id="your-partner-id"
label="Connect WhatsApp Business"
>
</dialog-connect-button>
<script>
document.addEventListener('dialog-connect-callback', event => {
console.log('Client ID:', event.detail.client);
console.log('Channels:', event.detail.channels);
});
</script>
</body>
</html>
For more detailed vanilla JavaScript usage examples and API documentation, see VANILLA-USAGE.md.
Following properties are supported by the button component:
| Property name | Type | Description | Required |
|---|---|---|---|
| partnerId | string | Your 360dialog Partner ID | ✅ |
| callback | (callbackObject: {client: string, channels: string[], revokedChannels?: string[]}) => void | Callback function, that receives the returned client ID as well as channel IDs | ✅ |
| requestedNumber | string | Optional parameter to request access for a specific phone number | |
| label | string | Optional parameter to provide a custom button label | |
| queryParameters | {email?: string, name?: string, state?: string, redirect_url?: string, next?: string, plan_selection?: string, flow?: string, io_signature?: string, io_timestamp?: string, preverified_phone_number_id?: string} | Optional query parameters that get passed to the sign up form for pre-filling | |
| version | 'v1' | 'v2' | Hub version to connect to — v1 uses hub.360dialog.com, v2 uses app.360dialog.com (default: 'v1') | |
| useNewRedirect | boolean | Use the new CH IO redirect URL (default: false) |
The ConnectButton React component is an unstyled <button /> component. You can use any styling method, e.g. CSS-in-JS libraries such as styled-components.
import { ConnectButton } from '360dialog-connect-button';
const App = () => {
const StyledConnectButton = styled(ConnectButton)`
outline: none;
background: #ff4369;
color: white;
padding: 8px 16px;
border-radius: 3px;
margin-top: 32px;
border: none;
`;
return (
<div>
<StyledConnectButton
partnerId={'your-partner-id'}
callback={handleCallback}
/>
</div>
);
};
The <dialog-connect-button> web component can be styled using CSS custom properties (CSS variables) or regular CSS targeting the element.
<style>
dialog-connect-button {
--dialog-connect-bg: #007bff;
--dialog-connect-color: white;
--dialog-connect-hover-bg: #0056b3;
--dialog-connect-padding: 12px 24px;
--dialog-connect-border-radius: 6px;
--dialog-connect-font-size: 16px;
}
</style>
<dialog-connect-button
partner-id="your-partner-id"
label="Connect WhatsApp Business"
>
</dialog-connect-button>
| Property | Description | Default Value |
|---|---|---|
--dialog-connect-bg | Background color | #007bff |
--dialog-connect-color | Text color | white |
--dialog-connect-border | Border style | none |
--dialog-connect-padding | Button padding | 12px 24px |
--dialog-connect-border-radius | Border radius | 4px |
--dialog-connect-font-size | Font size | 14px |
--dialog-connect-font-family | Font family | System fonts |
--dialog-connect-transition | CSS transition | all 0.2s ease |
--dialog-connect-hover-bg | Hover background color | Darker variant |
--dialog-connect-hover-color | Hover text color | Same as base |
--dialog-connect-active-bg | Active background color | Darker variant |
--dialog-connect-disabled-bg | Disabled background color | #ccc |
--dialog-connect-disabled-color | Disabled text color | #666 |
<style>
.my-connect-button {
--dialog-connect-bg: #28a745;
--dialog-connect-hover-bg: #218838;
--dialog-connect-padding: 14px 28px;
--dialog-connect-font-size: 18px;
--dialog-connect-border-radius: 8px;
}
</style>
<dialog-connect-button
class="my-connect-button"
partner-id="your-partner-id"
label="🚀 Get Started"
>
</dialog-connect-button>
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
tsdxEnvironment{
"local_name": "tsdx",
"alias": false,
"peer_metadata": null
} | ^0.14.1 | development |
huskyEnvironment{
"local_name": "husky",
"alias": false,
"peer_metadata": null
} | ^7.0.4 | development |
reactEnvironment{
"local_name": "react",
"alias": false,
"peer_metadata": null
} | ^17.0.2 | development |
tslibEnvironment{
"local_name": "tslib",
"alias": false,
"peer_metadata": null
} | ^2.3.1 | development |
react-domEnvironment{
"local_name": "react-dom",
"alias": false,
"peer_metadata": null
} | ^17.0.2 | development |
size-limitEnvironment{
"local_name": "size-limit",
"alias": false,
"peer_metadata": null
} | ^7.0.5 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^4.5.5 | development |
@types/reactEnvironment{
"local_name": "@types/react",
"alias": false,
"peer_metadata": null
} | ^17.0.38 | development |
@types/react-domEnvironment{
"local_name": "@types/react-dom",
"alias": false,
"peer_metadata": null
} | ^17.0.11 | development |
@size-limit/preset-small-libEnvironment{
"local_name": "@size-limit/preset-small-lib",
"alias": false,
"peer_metadata": null
} | ^7.0.5 | development |
reactEnvironment{
"local_name": "react",
"alias": false,
"peer_metadata": null
} | >=16 | peer |
Source distribution
{
"shasum": "641f8a528856af59eb17d12a20a4462f12bf1d15",
"tarball": "https://registry.npmjs.org/360dialog-connect-button/-/360dialog-connect-button-0.7.0.tgz",
"fileCount": 16,
"integrity": "sha512-5wjuWFFQmG+h0BOTjZsZBB2nc6RdO7YZynduTOoS+eoIegKSsWp3W5BDBA2qQ94cDC7Jw5hQqEogYL0rXgOLUg==",
"signatures": [
{
"sig": "MEQCIGUln+dpRIiFTOHooazjAEHsGqD7J+mWNxVe/dXS4SPUAiAZ137TgLfBwldCUHKGC9aq9O4hgv9cOFNozGh3Gb+R2g==",
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
}
],
"unpackedSize": 51245,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjkHd/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrJTw//W1Bc8OFPulmkajeZrmc0EPmnT+yJNpa4JnCWtKIgfrF5EGgT\r\nEzRTkpUdTV0XK0MHB07y4hDl1GjMjinMM5N9ZrUeXedGl7GR5xTXm7dfM9xU\r\nJKSIRrXB4nhvW2wJXRgtR2FXG2y85itLs4frOxdzniyuH0EQtKgpkGDxjf8x\r\n+nAi/S9z/mWFlZoXHVrgq5GNQboE3lUuEQRk8+A34uBVrhhfyopNdP0Zc73x\r\nwRX2j5PIVZLcbEvHyEpQ8S7uspZrEbTUoP2Y9ham8G1CT+MhnrKXKsfwQIxR\r\nKhQGpMobwPm0aAIxPNYOCTPvpXlxvgJ+8vIqosLWLIQ6V5ZEio7Kve9EDirB\r\ndJmSzTSuZ1rUtb2o4dZFsYu/+k2GbxqiNJhw7o7K3Z7pMQ/ErpxpxV1oRBP1\r\n2Kiz6qoC/EHPpRf87pSIQRex92Vib7EOa42tru3LRZiaYtcooTc1ggXHO2nD\r\nOVR5Ewanct/rdR2lp9zI17Pjsv81zn5ZIaCwAvpPI3vBq/ZEoJujTis2JMxh\r\nKc2k0WBDtm1irRvLv6dO1gl/HWp0cYnfCkRkcFkIu3UOQORNqjHt+tgd3kYp\r\nqv+dQa0t0LPmOk3zbS1bs2z324VhLc4iUfZrv0u4UmKm2TM7tkaYRdXD/vVT\r\naHXzL/8Qv07b7uk6r0Sre4onntH0KMQ1XdU=\r\n=KVO8\r\n-----END PGP SIGNATURE-----\r\n"
}Observed since 20 Oct, 19:26 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:ef5eb377237d8d69da7a4e63133ef6746b878dbe41751ab0a6459728ba7a0ef9