1
0
-1

I want to create a button via which i can send SMS to any mobile number. I know that i need to write custom JavaScript for it but output is not coming. Can you guys help me with it. Give me a guidance with code for sms integration.

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      I do not want to use JSON tool because i need a extra button in my form named as Generate OTP.  I want have written one JS code which is:

      <script type="text/javascript">
      function sendsms(){

      var data = null;

      var xhr = new XMLHttpRequest();
      xhr.withCredentials = true;

      xhr.addEventListener("readystatechange", function () {

      if (this.readyState === this.DONE) {
      console.log(this.responseText);
      }
      });

      xhr.open("POST", "https://2factor.in/API/V1/API KEY/SMS/MobileNumber/OTP");

      xhr.send(data);

      alert("Send");

      }

      </script>
      <body>
      <input type="button" value=" OTP" onclick="sendsms()" style='margin-left: 30%'/>
      </body>


      But this code is static. I am mentioning mobile number and OTP in the url. I have created one variable which creates random 4 digit number. How to pass that variable value in url string. Also i want mobile number dynamic means mobile number present in text-filed only to taht number sms should go. I am storing that number in variable but how to pass it.

      1. Anders

        You can try using Hash Variables to fill in the dynamic values.

      2. Rushikesh Haral

        No it is not working

      3. Rushikesh Haral

        And hash variables do not work within same form.

      CommentAdd your comment...
    2.  
      1
      0
      -1

      What have you written so far? I would imagine that you are given the RESTFUL API by your sms provider, then you can invoke it from Joget using JSON Tool.

        CommentAdd your comment...