Button for WhatsApp Group

Introduction

The following example shows how we can add a button to access a WhatsApp group. With the filter 'joinchat_omnichannel_apps' you can add, remove or modify OmniChannel apps.

To implement this functionality we are going to use a “Snippet” and as in other occasions we are going to use Code Snippets plugin, and from here you can download the JSON to be able to import it from the plugin, but if you feel comfortable you can do it as you prefer.

Code

function joinchat_omnichannel_add_wagroup( $channels ) {
	$channels['wagroup'] = array(
		'name'        => 'WhatsApp Group',
		'scheme'      => 'https://chat.whatsapp.com/{ID}',
		'placeholder' => 'CVVl8RxHxyk0PcBKfWMEvH',
		'img'         => 'https://cdn.join.chat/app/uploads/2022/06/whatsapp-group-x2x.png',
		'help'        => 'WhatsApp Group ID',
	);
	return $channels;
}
add_filter( 'joinchat_omnichannel_apps', 'joinchat_omnichannel_add_wagroup' );

This will provide you with a WhatsApp group link ready to enter the group ID from the Join.Chat> Channels settings.

Notes

NOTE 1: the 'scheme' must use the variable {ID} which will be replaced by the user, in this case, the e-mail address. You can also use {MSG} if the link to the app allows you to send an initial message.

NOTE 2: in this example we are using an image hosted in joinchat, but you can replace it with any image you want.

Content

🍪 We use cookies to personalize and enhance your experience on our site. Visit our Privacy Policy to learn more.

BY USING OUR SITE, YOU AGREE TO OUR USE OF COOKIES.