Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated+5.1+selfhosting+compatiable #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
* @link http://mautic.org
*
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* @author Jan Kozak <[email protected]>
* @author Ravinayag <[email protected]>
*/

return [
'name' => 'Whatsapp',
'description' => 'Whatsapp integration',
'author' => '[email protected]',
'version' => '0.0.2',
'version' => '0.0.3',
'services' => [
'events' => [],
'forms' => [
Expand Down Expand Up @@ -79,5 +81,5 @@
],
],
],
'parameters' => [],
'parameters' => [ ],
];
83 changes: 48 additions & 35 deletions Integration/WhatsappIntegration.php
Original file line number Diff line number Diff line change
@@ -1,85 +1,98 @@
<?php

/*
* @copyright 2014 Mautic Contributors. All rights reserved
* @copyright 2018 Mautic Contributors. All rights reserved
* @author Mautic
*
* @link http://mautic.org
*
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* @author Jan Kozak <[email protected]>
* @author Ravinayag <[email protected]>
*/

namespace MauticPlugin\MauticWhatsappBundle\Integration;

use Mautic\PluginBundle\Integration\AbstractIntegration;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Url;

/**
* Class WhatsappIntegration.
*/
class WhatsappIntegration extends AbstractIntegration
{
/**
* {@inheritdoc}
*
* @return string
*/
public function getName()
{
return 'Whatsapp';
}

/**
* {@inheritdoc}
*
* @return string
*/
public function getIcon()
{
return 'plugins/MauticWhatsappBundle/Assets/img/whatsapp.png';
}

/**
* {@inheritdoc}
*
* @return array
*/
public function getSecretKeys()
{
return [];
return ['apiKey'];
}

/**
* {@inheritdoc}
*
* @return array
*/
public function getRequiredKeyFields()
{
return [
'api_key' => 'mautic.plugin.whatsapp.api_key',
'apiKey' => 'mautic.plugin.whatsapp.apiKey',
'apiUrl' => 'mautic.plugin.whatsapp.apiUrl',
];
}

/**
* @return array
*/
public function getFormSettings()
public function getFormSettings(): array
{
return [
'requires_callback' => false,
'requires_authorization' => false,
];
}

public function getAuthenticationType()
{
return 'none';
}

/**
* {@inheritdoc}
*
* @return string
*/
public function getAuthenticationType()
public function getConfigFormFields()
{
return 'none';
return [
'apiKey' => [
'label' => 'mautic.plugin.whatsapp.apiKey',
'label_attr' => ['class' => 'control-label'],
'attr' => [
'class' => 'form-control',
'tooltip' => 'mautic.plugin.whatsapp.apiKey.tooltip',
],
'constraints' => [
new NotBlank([
'message' => 'mautic.core.value.required',
]),
],
'type' => TextType::class,
],
'apiUrl' => [
'label' => 'mautic.plugin.whatsapp.apiUrl',
'label_attr' => ['class' => 'control-label'],
'attr' => [
'class' => 'form-control',
'tooltip' => 'mautic.plugin.whatsapp.apiUrl.tooltip',
],
'constraints' => [
new NotBlank([
'message' => 'mautic.core.value.required',
]),
new Url([
'message' => 'mautic.core.valid_url_required',
]),
],
'type' => UrlType::class,
],
];
}
}
24 changes: 24 additions & 0 deletions MauticWhatsappBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,34 @@
namespace MauticPlugin\MauticWhatsappBundle;

use Mautic\PluginBundle\Bundle\PluginBundleBase;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
* Class MauticWhatsappBundle.
*/
class MauticWhatsappBundle extends PluginBundleBase
{
/**
* * {@inheritdoc}
* */
public function build(ContainerBuilder $container)
{
parent::build($container);
}

/**
* * {@inheritdoc}
* */
public function boot()
{
parent::boot();
}

/**
* * {@inheritdoc}
* */
public function getParent()
{
return 'MauticSmsBundle';
}
}
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Mautic Whatsapp Plugin
This plugin replaces the SMS channel and allows you to send messages to Whatsapp
using the Wo-Wa Whatsapp Web application.
Intended for >= Mautic 4.0
using the self-hosted Whatsapp Web application server.
Orginally its Intended for >= Mautic 4.0, But i worked on mautic 5.1, So expected to work >= 5.1

Read more:
https://joeykeller.com/weekend-project-a-mautic-whatsapp-plugin
Read more [here](https://joeykeller.com/weekend-project-a-mautic-whatsapp-plugin) for the History:

## Installation by console
1. Download the plugin, unzip in your plugins folder
Expand All @@ -14,8 +13,9 @@ https://joeykeller.com/weekend-project-a-mautic-whatsapp-plugin
## Usage
1. Go to your **Plugins** in Mautic
2. You should see new Whatsapp plugin in the list, click and publish it.
3. Go to https://joeykeller.com/weekend-project-a-mautic-whatsapp-plugin, and see how you can get your credentials.
3. Get [API Key](https://ravinayag.medium.com/mautic-digital-marketing-tool-859cd3ce0484) and see how you can get your credentials.
4. This plugin overrides your SMS transport. In your **Configuration > Text message settings** select Whatsapp as default transport

Check my blog for updates and Mautic guides:
Joeykeller.com
## DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
3 changes: 2 additions & 1 deletion Translations/en_US/messages.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mautic.sms.transport.whatsapp="Whatsapp MSG"
mautic.sms.config.transport.whatsapp="Whatsapp MSG"
mautic.plugin.whatsapp.api_key="Wo-wa API Key"
mautic.plugin.whatsapp.apiKey="DevOpz API Key"
mautic.plugin.whatsapp.apiUrl="Whatsapp API URL"
mautic.plugin.whatsapp.sender_id="Sender phone number"
Loading