4 Replies Latest reply on Jul 24, 2017 1:09 PM by Johan Hedman

    Whatsapp within fmp

    david.angel@rocketmail.com

      I want to create the option to send to WhatsApp phones stored in FMP.

      I found a site named whatsmate.net , it´s a rest service, they have php (https://whatsmate.github.io/2016-02-20-send-whatsapp-message-php/), c, java codes to integrate with those languages, they use cURL which is now available in filemaker 16 and filemaer 15 has a plugin for that purposes. I´m new to cURL don´t know much about it and don´t know from where to start.

      Any suggestions, help be appreciated.

        • 1. Re: Whatsapp within fmp
          Johan Hedman

          With the script step Insert from URL you can use that url to talk to any other API out there on the Internet.

          • 2. Re: Whatsapp within fmp
            fmpdude

            As johanhedman said in his posting you don't need to worry about CURL. With INSERT FROM URL, you can access most APIs out there. If you need even more control, you can combine INSERT FROM URL with a microservice and basically do anything.

             

            INSERT FROM URL has been around since FMP 12. I use it extensively.

             

            Just figure out your GET or POST (post was added in FMP 13) requests first.

             

            HOPE THIS HELPS.

            • 3. Re: Whatsapp within fmp
              david.angel@rocketmail.com

              Below is the php code they give to communicate, with their system. Should I pass all the code to an $url variable and place it in the insert from url , that is what you saying ?How to pass to the code the WhatsApp number? that is stored in a field in my database.

              Regards, DA

               

               

              <?php

              $INSTANCE_ID = 'YOUR_INSTANCE_ID_HERE'; // TODO: Replace it with your gateway instance ID here

              $CLIENT_ID = "YOUR_CLIENT_ID_HERE"; // TODO: Replace it with your Forever Green client ID here

              $CLIENT_SECRET = "YOUR_CLIENT_SECRET_HERE"; // TODO: Replace it with your Forever Green client secret here

              $postData = array(

              'number' => '12025550108', // TODO: Specify the recipient's number here. NOT the gateway number

              'message' => 'Howdy! Is this exciting?'

              );

              $headers = array(

              'Content-Type: application/json',

              'X-WM-CLIENT-ID: '.$CLIENT_ID,

              'X-WM-CLIENT-SECRET: '.$CLIENT_SECRET

              );

              $url = 'http://api.whatsmate.net/v2/whatsapp/single/message/' . $INSTANCE_ID;

              $ch = curl_init($url);

              curl_setopt($ch, CURLOPT_POST, 1);

              curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

              curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

              curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData));

              $response = curl_exec($ch);

              echo "Response: ".$response;

              curl_close($ch);

              ?>

               

              • 4. Re: Whatsapp within fmp
                Johan Hedman

                You need to use Headers in your Insert from URL, but never the whole PHP-code.

                 

                With FM16 you can use cURL and you can learn of that in FileMaker Help or read this article

                https://dbservices.com/articles/filemaker-curl-options/

                1 of 1 people found this helpful