Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
add missing cron file and fix version
Browse files Browse the repository at this point in the history
  • Loading branch information
blopa committed Nov 30, 2017
1 parent 13f8fab commit de5c0a2
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 96 deletions.
185 changes: 94 additions & 91 deletions Magento1_deprecated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,98 +140,101 @@ Conversation
![ScreenShot](https://raw.githubusercontent.com/blopa/Magento-Chatbot/master/screenshots/conversation.jpg)

## Release Notes
- **v0.0.18:**
- Add missing cron file
- Fix module version
- **v0.0.17:**
- Add Abandoned Cart messages
- Enable all types of products to be listed
- Update module license for MIT license
- Add Abandoned Cart messages
- Enable all types of products to be listed
- Update module license for MIT license
- **v0.0.16:**
- Code improvements
- Fix flood of messages when disabling bot for human respond
- [Backend] Add module version to configuration
- Update wit.ai API version
- [Backend] Add options/commands to Welcome Message
- Code improvements
- Fix flood of messages when disabling bot for human respond
- [Backend] Add module version to configuration
- Update wit.ai API version
- [Backend] Add options/commands to Welcome Message
- **v0.0.15:**
- First stable version
- Add option to ignore certain messages using Default Replies
- Add Customer Chat ID to message for support
- Add module tables update from previous versions
- First stable version
- Add option to ignore certain messages using Default Replies
- Add Customer Chat ID to message for support
- Add module tables update from previous versions
- **v0.0.14:**
- Fix problem when setting Telegram Webhook
- Fix problem when sending message between different chat plataforms
- Fix small translation problems
- Code improvements
- Fix problem when setting Telegram Webhook
- Fix problem when sending message between different chat plataforms
- Fix small translation problems
- Code improvements
- **v0.0.13:**
- Code improvements
- Add admin commands listing on Telegram
- Fix problem when receiving 503 from wit.ai
- [Backend] Add option to disable Bot replies on Facebook (good for when a you need to reply on Page Messages)
- [Backend] Add option to open Messenger Box with referral
- [Backend] Add option to write the customer name in a message using "{customername}"
- Default Replies are now able to send big texts
- Order listing now uses Facebook Receipt layout
- Code improvements
- Add admin commands listing on Telegram
- Fix problem when receiving 503 from wit.ai
- [Backend] Add option to disable Bot replies on Facebook (good for when a you need to reply on Page Messages)
- [Backend] Add option to open Messenger Box with referral
- [Backend] Add option to write the customer name in a message using "{customername}"
- Default Replies are now able to send big texts
- Order listing now uses Facebook Receipt layout
- **v0.0.12:**
- Fix command alias
- Fix list categories command glitch
- Fix some other small glitches
- Code improvements
- Add Facebook Live Chat on store frontend
- [Customer] Speech recognition for Telegram
- [Backend] Option to enable/disable speech recognition
- [Backend] Layout improvements
- Fix command alias
- Fix list categories command glitch
- Fix some other small glitches
- Code improvements
- Add Facebook Live Chat on store frontend
- [Customer] Speech recognition for Telegram
- [Backend] Option to enable/disable speech recognition
- [Backend] Layout improvements
- **v0.0.11:**
- Fix logout command glitch
- Fix some other small glitches
- Code improvements
- Fix problem when replying a customer on support mode
- [Backend] Integration with wit.ai
- [Backend] Use wit.ai as match for a default reply
- [Customer] Add option do enable/disable receiving promotional messages
- Fix logout command glitch
- Fix some other small glitches
- Code improvements
- Fix problem when replying a customer on support mode
- [Backend] Integration with wit.ai
- [Backend] Use wit.ai as match for a default reply
- [Customer] Add option do enable/disable receiving promotional messages
- **v0.0.10:**
- [Backend] Add option to match a 'default reply' as a command
- [Backend] Add default fallback message
- [Backend] Add option to disable Telegram inline search
- [Backend] Add option to match a 'default reply' as a command
- [Backend] Add default fallback message
- [Backend] Add option to disable Telegram inline search
- **v0.0.9:**
- [Customer] Add inline search for Telegram
- Add price to product listing on Telegram
- Fix category buttons listing glitch on Telegram
- Fix regex validation
- Fix webhook security issue
- New webhook URL
- [Customer] Add inline search for Telegram
- Add price to product listing on Telegram
- Fix category buttons listing glitch on Telegram
- Fix regex validation
- Fix webhook security issue
- New webhook URL
- **v0.0.8:**
- [Backend] Add "starts with", "ends with", "contains", "equals to" and "regex" options to Default Replies
- [Backend] Better backend layout
- [Backend] Better way to enable/disable commands
- [Backend] Add "starts with", "ends with", "contains", "equals to" and "regex" options to Default Replies
- [Backend] Better backend layout
- [Backend] Better way to enable/disable commands
- **v0.0.7:**
- [Backend] Fix problems with URL
- [Customer] Add register command
- Add Chinese translation (big thanks to [leedssheung](https://github.com/leedssheung/))
- Show command list on "help" instead of "about"
- Fix buttons size on Telegram when listing categories
- [Backend] Add option to stop processing when sending a default reply
- [Backend] Fix problems with URL
- [Customer] Add register command
- Add Chinese translation (big thanks to [leedssheung](https://github.com/leedssheung/))
- Show command list on "help" instead of "about"
- Fix buttons size on Telegram when listing categories
- [Backend] Add option to stop processing when sending a default reply
- **v0.0.6:**
- [Backend] Better admin descriptions and typos
- [Backend] Better admin descriptions and typos
- **v0.0.5:**
- [Backend] Add Default Replies
- [Backend] Add option to unavailability message
- Better feedback messages
- [Backend] Add Default Replies
- [Backend] Add option to unavailability message
- Better feedback messages
- **v0.0.4:**
- Fix glitch on order listing
- Fix glitchs with product search and category listing
- Better feedback messages
- [Customer] Add logout command
- [Admin] Add feature to send message to all customers
- [Admin] Add option to enable/disable support for a customer
- Fix glitch on order listing
- Fix glitchs with product search and category listing
- Better feedback messages
- [Customer] Add logout command
- [Admin] Add feature to send message to all customers
- [Admin] Add option to enable/disable support for a customer
- **v0.0.3:**
- Limit products/orders listing
- Add stock validation for listing
- [Backend] Add option to enable/disable empty categories listing
- [Customer] Add search by SKU
- Limit products/orders listing
- Add stock validation for listing
- [Backend] Add option to enable/disable empty categories listing
- [Customer] Add search by SKU
- **v0.0.2:**
- Facebook integration
- [Admin] Cross platform messages with support mode
- Facebook integration
- [Admin] Cross platform messages with support mode
- **v0.0.1:**
- Telegram integration
- First working version
- Telegram integration
- First working version


## F.A.Q.
Expand All @@ -249,23 +252,23 @@ A: Thank you! You can help by codding more features, creating pull requests, or

## TODO
- **Integrations:**
- Whatsapp
- WeChat
- Microsoft Bot Framework / Skype
- ???
- Whatsapp
- WeChat
- Microsoft Bot Framework / Skype
- ???
- **Features:**
- Add message queueing
- Documentation / Tutorials / Videos
- Add a custom in-store message chat app
- Save support history
- Support for audio commands
- Better uses for wit.ai
- Force a command for a customer
- Integrate checkout to Facebook Payment API
- Save messages on database before sending to make sure it will be sent eventually
- Add "Add to cart" feature for configurable products and products with custom options
- Better approach for Abandoned Carts
- Add `CDATA` and `<tooltip>` to configuration descriptions
- Add message queueing
- Documentation / Tutorials / Videos
- Add a custom in-store message chat app
- Save support history
- Support for audio commands
- Better uses for wit.ai
- Force a command for a customer
- Integrate checkout to Facebook Payment API
- Save messages on database before sending to make sure it will be sent eventually
- Add "Add to cart" feature for configurable products and products with custom options
- Better approach for Abandoned Carts
- Add `CDATA` and `<tooltip>` to configuration descriptions

## License
Free. Don't forget to star :D and send pull requests. :D
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
require_once("Api/Facebook/MessengerBot.php");
require_once("Api/Telegram/TelegramBot.php");

// handle all cron tasks.
class Werules_Chatbot_Model_Cron
{
public function crontask()
{
//Mage::log("Cron processed", null, 'chatbot_cron.log');

$chatbotCollection = Mage::getModel('chatbot/chatdata')->getCollection();
foreach($chatbotCollection as $chatbot)
{
//$hasQuote = $chatbot->getSessionId() && $chatbot->getQuoteId(); // has class quote and session ids
$enabled = // if backend promotional messages are disabled or if the customer wants to receive promotional messages
(Mage::getStoreConfig('chatbot_enable/general_config/disable_promotional_messages') != "1") ||
($chatbot->getEnablePromotionalMessages() == "1");
$customer = Mage::getModel('customer/customer')->load((int)$chatbot->getCustomerId());
if (($customer->getId()) && ($enabled)) // if is a valid customer id
{
$fbChatId = $chatbot->getFacebookChatId();
$tgChatId = $chatbot->getTelegramChatId();
$customerId = $customer->getId();
$lifetime = (int)Mage::getStoreConfig('chatbot_enable/general_config/abandoned_cart_days');
//$lifetime = 7;
$quotes = Mage::getModel( 'sales/quote' )->getCollection();
$quotes->addFieldToFilter('customer_id', $customerId)
//->addFieldToFilter('is_active', 1)
->addFieldToFilter('updated_at', array('to' => date("Y-m-d", time() - ($lifetime * 86400))))
;
if (count($quotes) > 0) // TODO
{
$enableFb = Mage::getStoreConfig('chatbot_enable/facebook_config/enable_abandoned_cart');
$enableTg = Mage::getStoreConfig('chatbot_enable/telegram_config/enable_abandoned_cart');

if ($enableFb == "1") // messenger
{
$message = Mage::getStoreConfig('chatbot_enable/facebook_config/abandoned_cart_msg');
if ($message != "")
{
$apikey = Mage::getStoreConfig('chatbot_enable/facebook_config/facebook_api_key');
$facebook = new MessengerBot($apikey);
$facebook->postMessage($fbChatId, $message);
}
}
if ($enableTg == "1") // telegram
{
$message = Mage::getStoreConfig('chatbot_enable/telegram_config/abandoned_cart_msg');
if ($message != "")
{
$apikey = Mage::getStoreConfig('chatbot_enable/telegram_config/telegram_api_key');
$facebook = new TelegramBot($apikey);
$facebook->postMessage($tgChatId, $message);
}
}
}
// foreach($quotes as $quote)
// {
// $orders = Mage::getModel('sales/order')->getCollection();
// $orders->addFieldToFilter('quote_id', $quote->getId());
// $items = Mage::getModel('sales/quote_item')
// ->getCollection()
// ->setQuote($quote);
// }
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<Werules_Chatbot>
<version>0.0.16</version>
<version>0.0.18</version>
</Werules_Chatbot>
</modules>
<crontab>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment><![CDATA[<h3>Magento Chatbot v0.0.16</h3><p>To Use This Module You'll Need to Have SSL Enabled in Your Store.</p>]]></comment>
<comment><![CDATA[<h3>Magento Chatbot v0.0.18</h3><p>To Use This Module You'll Need to Have SSL Enabled in Your Store.</p>]]></comment>
<fields>
<your_custom_key>
<label>Your Secret Key</label>
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,13 @@ Go to **System > General Settings > Chatbot Settings**
- Much more
### Magento1
#### Deprecated versions
- **v0.0.18:**
- Add missing cron file
- Fix module version
- **v0.0.17:**
- Add Abandoned Cart messages
- Enable all types of products to be listed
- Update module license for MIT license
- Add Abandoned Cart messages
- Enable all types of products to be listed
- Update module license for MIT license
- **v0.0.16:**
- Code improvements
- Fix flood of messages when disabling bot for human respond
Expand Down

0 comments on commit de5c0a2

Please sign in to comment.