cancel
Showing results for 
Search instead for 
Did you mean: 

How to Send Mag::Log error using Whatsapp, is it Possible?

Highlighted

How to Send Mag::Log error using Whatsapp, is it Possible?

How can i send my EventObserver log message by whatsapp message?

3 REPLIES 3
Highlighted

Re: How to Send Mag::Log error using Whatsapp, is it Possible?

@curtnorvalf534 As per technology everything possible the way of try may be different but everything possible, we did it, using Twilio API.

Highlighted

Re: How to Send Mag::Log error using Whatsapp, is it Possible?

I do not know that. I am very interested in this, can you share more?

Highlighted

Re: How to Send Mag::Log error using Whatsapp, is it Possible?

@curtnorvalf534 Whenever log generated pass to WhatsApp using Twilio, go to Twilio document you will get some idea.

 

My observer:

 

<?php

ini_set("memory_limit", "-1");

require_once '/home/website/public_html/website_whatsapp_notification/vendor/autoload.php';

use Twilio\Rest\Client;

class Gta_MatchProductOrder_Model_Observer

    {


        public function checkproductinorder($Observer)

        {

           
          $sid    = "hrgrugrgrbggbeibgurbgrgbreu";

          $token  = "dngfngrgngnrtngngregrngreug";

          $twilio = new Client($sid, $token);

          $order = $Observer->getEvent()->getOrder();

          $items = $order->getAllItems();

          $skus = array('6250109',	'6926238',	'6250108'); //product SKUs

          $skuList = array();

          foreach ($items as $item) 

            {

             if(in_array($item->getSku(), $skus))

              {

                $orderid = $Observer->getEvent()->getOrder()->getIncrementId();

                $skuList[] = $item->getSku();

              }

            }

              // Mage::log('The order Id ' . $orderid . ' contains amazon list SKU : '.implode(',',$skuList), null, 'matchorder.log');

            $messagesss = $twilio->messages

                  ->create("whatsapp:+01236459877", // to

                           array(

                               "from" => "whatsapp:+02158745225",

                               "body" => 'The order Id ' . $orderid . ' contains amazon list SKU : '.implode(',',$skuList)

                           )

                  );

                 
            ### start test observer ###

            // $order = $Observer->getEvent();

            // Mage::log($order->getName(),null,'orderproduct.log');

            ### end test observer ###

        } 

    }