Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Sending SMS with SMS Twilio Action

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sending SMS with SMS Twilio Action

    Hi,
    I'm using the "Send SMS Message using Twilio" Action in a UX to send text messages using the example here:

    Does anyone know how I can send a message to multiple phone numbers?

    https://www.youtube.com/watch?v=4GFxvrgzUVc

    Thanks!
    Dave

    #2
    Re: Sending SMS with SMS Twilio Action

    *bump*

    Here is a method I've been playing with (code below). It works for the most part. The problem is if I stick this in an inline-javascript action (so I can do something before and after) I get Server 500 errors. If I add any wait messages before the code I get server 500 errors. Even adding a hideWaitMessage method at the end gives me a server 500 error.

    I'm thinking Alpha didn't mean for this to send batch messages. Anyone here sending batch messages with Twilio? I know I could sit down and read the API but looking for a head start on this.

    Code:
    debugger;
    var lObj = {dialog.object}.getControl('list1');
    //list selection length
    var cnt = lObj.selectionData.length;
    //Get message data
    var msg = {dialog.object}.getValue('message');
    
    //Loop through list selections and send messages
    for (i=0;i<cnt;i++) {
    	var objx = {dialog.object}._ajaxCallbackCompleteCode;
    	var callbackId = A5.UUID();
    	objx[callbackId] = {};
    	objx[callbackId].success = function() { 
    	alert('Success!');
    	};
    	objx[callbackId].fail = function(error) { 
    	alert('Send Failed!');
    	};
    	
    	//Next phone number to send
    	var phonenum = lObj.selectionData[i].Phonenumber;
    	
    	//alert(phonenum);
    	
    	var _cbData = A5.ajax.buildURLParam('_smsdata',JSON.stringify({"message": msg,"toNumber": phonenum,"xbasicFunction": "sendSMS_*********hidden**********"}));
    	_cbData = _cbData + '&_callbackId2=' + callbackId;
    	{dialog.object}.ajaxCallback('','','system:sendSMS','',_cbData, {errorFunction: function() { }, deviceOfflineFunction: function() { } })
    }
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant​​

    Comment


      #3
      Re: Sending SMS with SMS Twilio Action

      Dave
      I hope you get an answer to this ...... I also need help with sending about 300 SMS text messages (at one time) with Twilio from a UX, that grabs the cell number from a field "cellphone" from 300 different customers.
      Thanks
      Tony

      Comment


        #4
        Re: Sending SMS with SMS Twilio Action

        Dave
        I have used this code to send batch emails for several years, but it is in xBasic (obtained from help on this message board)
        I assume what is needed is the same result, but using a Javascript Function (above my pay grade at this time)

        function emailSendSMTP as c (e as p)

        dim cn as sql::Connection
        dim flag as l
        dim sqlStmt as c
        dim rs as sql::ResultSet
        dim cntEmail as n = 0
        dim pm as P
        dim ps as P

        'change this to your AlphaDAO connection string name
        flag = cn.open("::Name::Golf")

        if flag then

        sqlStmt = "SELECT email from golfers WHERE email <> '' and Notify = 'E' OR email <> '' and Notify = 'B'"

        'first get a record count
        flag = cn.Execute(sqlStmt)
        if flag then
        'ALL OK
        rs = cn.ResultSet
        while rs.NextRow()

        'send your emails
        if (email_smtp_open(ps, "smtp.emailsrvr.com", 25, "[email protected]", "Hoolie71"))then
        pm.to = rs.data("email")
        pm.from = "[email protected]"
        pm.from_alias = "Anson Golf"
        pm.subject = e._currentRowDataNew.subject
        pm.html_message = e._currentRowDataNew.messageBody
        email_smtp_send(pm, ps)
        end if
        email_smtp_close(ps)

        cntEmail = cntEmail + 1
        end while
        emailSendSMTP = "emailResult('" + cntEmail + "');"

        else
        'there was an error - close the connection and exit
        cn.Close()
        dim msg as c
        msg = "Could not execute the query. Error reported was: " + cn.CallResult.text
        msg = js_escape(msg)
        dim jscmd as c
        jscmd = "alert('" + msg + "');"
        emailSendSMTP = jscmd
        exit function
        end if

        else
        'there was an error - close the connection and exit
        dim msg as c
        msg = "Could not open the connection. Error reported was: " + cn.CallResult.text
        msg = js_escape(msg)
        dim jscmd as c
        jscmd = "alert('" + msg + "');"
        emailSendSMTP = jscmd
        exit function
        end if

        cn.FreeResult()
        cn.close()

        end function


        Maybe someone out there can write this in javascript and we can give it a try

        Thanks
        Tony

        Comment


          #5
          Re: Sending SMS with SMS Twilio Action

          Dave or Mike or others .....
          Any solution to this thread or advice
          Thanks
          Tony

          Comment


            #6
            Re: Sending SMS with SMS Twilio Action

            I am also working on an app that sends messages to prospective employees for a client of mine. We have built a UX that captures Name, Location, Cell Phone, CELL PROVIDER, and an Ink Signature. With this information we are able to search a list by any criteria, and then send emails to the (Cell #) @ (Cell Provider Domain) ie. @vtext.com for Verizon.

            This allows the client to verify that the emails were sent and if there is a reply to the email SMS, then the sender gets an email response. All this is as free as your email service. Since this is a new app and will collect all new data, this method works. If you have a list with just cell #'s you would have to figure out how to find out a particular #'s provider. I am sure there is an API out there that would do that.
            ---------------------------------------------------
            Barry Kucher
            http://www.411tech.org

            Comment


              #7
              Re: Sending SMS with SMS Twilio Action

              Barry
              Thanks for the reply.
              I currently have a working UX that I can filter and send multiple texts thru emails
              The good thing about possibly using Twilio in the future, is that you don't have to know cell phone providers and the texts look much more professional.
              But I'm not much the code writing, so just hoping someone will reply with necessary code or maybe Alpha will make a video on how to do this.
              Good Luck!
              Tony

              Comment


                #8
                Re: Sending SMS with SMS Twilio Action

                look below in similar threads, and check out the first link some posts down may be 10 or 15 posts later. you will find the working code.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                  #9
                  Re: Sending SMS with SMS Twilio Action

                  Gandhi

                  Not sure we are talking about the same thing or more than likely, I'm doing a poor job of explaining .....

                  I need help with a javascript function that I is required on a button event "Sending SMS messages using Twilio" where I choose the following options:

                  To number type: JavascriptFunction (other option is Explicit)
                  To number: "name of my javascript function" (other option would be one cellphone number)

                  The javascript function needs to loop thru my table and retrieve only records where the field "member" has a value of "Yes" and returns multiple cellphone numbers


                  Hopefully the the following attachment helps with where and what I am trying to do

                  twilio.PNG

                  Thanks!!!
                  Tony

                  Comment


                    #10
                    Re: Sending SMS with SMS Twilio Action

                    sorry, tony.
                    now i see you have posted working xbasic code in post #4.
                    my mistake.
                    Last edited by GGandhi; 02-16-2017, 07:41 AM.
                    thanks for reading

                    gandhi

                    version 11 3381 - 4096
                    mysql backend
                    http://www.alphawebprogramming.blogspot.com
                    [email protected]
                    Skype:[email protected]
                    1 914 924 5171

                    Comment


                      #11
                      Re: Sending SMS with SMS Twilio Action

                      you could write an ajaxcallback and return a list of phonenumbers separated by comma as the end point. and call that function.
                      in general that function will look like this:
                      Code:
                      function xb as c (e as p)
                      dim cn as sql::Connection
                      dim result as l = .f.
                      dim sqlSelect as c
                      dim rs as sql::ResultSet
                      dim txt as c = ""
                      dim js as c
                      result = cn.Open("::Name::local_MySql")
                      if result then
                      	sqlSelect = "SELECT * FROM customer"
                      	result = cn.Execute(sqlSelect)
                      	if result then
                      		rs = cn.ResultSet
                      		result = rs.nextRow()
                      		while result
                      			txt = txt + rs.data("phone_number") + ","
                      			result = rs.nextRow()
                      			end while
                      	end if
                      	cn.close()
                      end if
                      js = "{dialog.object}.setValue('RESULT', '" +txt+"');" // you do not need this line change it to render the phone numbers only
                      	xb = js
                      end function
                      and the javascript function could be
                      {Dialog.Object}.ajaxCallback('','','xb','','');
                      or
                      from grid then
                      {grid.Object}.ajaxCallback('G,':all','xb','','');
                      thanks for reading

                      gandhi

                      version 11 3381 - 4096
                      mysql backend
                      http://www.alphawebprogramming.blogspot.com
                      [email protected]
                      Skype:[email protected]
                      1 914 924 5171

                      Comment


                        #12
                        Re: Sending SMS with SMS Twilio Action

                        Gandhi
                        Looks great!
                        I will work on this when I get in from the road this week.

                        I assume all I need is a list of phone numbers separated by commas ...... that gets inserted into the "To Number"
                        So not sure I understand "// you do not need this line change it to render the phone numbers only"

                        Thanks!
                        Tony

                        Comment


                          #13
                          Re: Sending SMS with SMS Twilio Action

                          So not sure I understand "// you do not need this line change it to render the phone numbers only"
                          i used it to test to populate a dialog text area.
                          yes the function will return a txt string filled with phone numbers separated by comma.
                          thanks for reading

                          gandhi

                          version 11 3381 - 4096
                          mysql backend
                          http://www.alphawebprogramming.blogspot.com
                          [email protected]
                          Skype:[email protected]
                          1 914 924 5171

                          Comment


                            #14
                            Re: Sending SMS with SMS Twilio Action

                            GGandhi

                            I have the xbasic code you sent me returning a good list of cellphone numbers, separtatd by commas.

                            Now the Javascript to call the xbasic.

                            From looking at other examples and just taking a guess at what it should be, this is what I currently have saved in Javascript functions for the UX, that is not working

                            function JS_Send_Text(){

                            {Dialog.Object.ajaxCallback('','','xb','','');

                            }


                            The two attachments show where and what I currently have that is incorrect

                            Twilio3.PNGTwilioJS.PNG

                            Can you see and point out what I am doing wrong
                            Thanks
                            Tony

                            Comment


                              #15
                              Re: Sending SMS with SMS Twilio Action

                              I am not at my computer, won't be for a week so I cannot be certain, but your JavaScript has an error, I do not know that is causing it
                              The dialog object should be
                              {dialog.object}
                              You are missing the right smiley, -picture2
                              Also the call to JavaScript function should end in () -picture1
                              If you correct these still won't work post back. When I come back I will post additional code for you.
                              thanks for reading

                              gandhi

                              version 11 3381 - 4096
                              mysql backend
                              http://www.alphawebprogramming.blogspot.com
                              [email protected]
                              Skype:[email protected]
                              1 914 924 5171

                              Comment

                              Working...
                              X