Whatsapp connect button

The WhatsApp Connect Button enables connecting a WhatsApp account for enhanced Recrubo functionality. An organization can only have one WhatsApp account connected at a time. This connection allows the WhatsApp account to:

  • Chat via WhatsApp using the Inbox.

  • Send messages via the API.

  • Receive messages via the API

The two button states

Parameters

Parameter
Type
Description
Required

action

String

Will be initialize as this component does not have other actions.

Yes

token

String

Authentication token to authorize the component.

Yes

settings

Object

JSON object containing configuration settings for the Inbox component.

No

Actions

Action
Description
Arguments
Settings

initialize

Initializes the component.

settings JSON object of new configuration settings.

Configuration Settings

Setting
Type
Description
Default

allowDisconnect

boolean

The allowDisconnect boolean allows you to disable the option to disconnect a WhatsApp account to prevent users from accidentally disconnecting.

true

Initialize

To load the Whatsapp Connect Button in to your application, you need to embed the component's iframe in your HTML. The iframe's src attribute should be set to https://api.recrubo.app/public/v2/embed/component/whatsapp-connect.

Example

<iframe id="whatsappConnectFrame" src="https://api.recrubo.app/public/v2/embed/component/whatsapp-connect" class="w-full h-full"></iframe>

<script type="text/javascript">
const whatsappConnect = document.querySelector('#whatsappConnectFrame')

whatsappConnect.onload = (evt) => {
    const whatsappConnectSettings = {
        action: 'initialize',
        token: 'XX-XX-XX-XX',
        settings: {
            whatsappConnect: {
                allowDisconnect: true
            }
        }
    }

    whatsappConnect.contentWindow.postMessage(whatsappConnectSettings, 'https://recrubo.app')
}
</script>

Last updated