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

Twilio SMS working code and question.

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

    Twilio SMS working code and question.

    I use Twilio to send SMS. This is the code and it works. You have to provide the following: Twilio SID, Token and a message. Does anyone know how to add the StatusCallback parameter and how to setup an a5w page to handle the response?

    Thank you.

    Rick Reeves
    941-737-9299


    dim cf_1 as extension::CurlFile
    dim flag_1 as l
    dim ce as extension::Curl

    vTwilioURLPre="https://api.twilio.com/2010-04-01/Accounts/"
    vSID =""
    vTwilioURL=vTwilioURLPre+vSID+"/Messages"
    vToken = ""
    vPassword=vSID+":"+vToken
    vMessage="This is a test SMS."

    vToNumber="9415551212"
    vTo="&To=+1"+vToNumber

    vFromNumber="9415551212"
    vFrom="&From=+1"+vFromNumber

    vBody = "Body="+urlencode(vMessage)
    vPostFields=vBody+vTo+vFrom

    ce = extension::Curl.Init()
    ce.setOpt("URL",vTwilioURL)
    ce.setOpt("NOPROGRESS",1)
    ce.setOpt("USERPWD",vPassword)
    ce.setOpt("POSTFIELDS",vPostFields)
    ce.setOpt("POSTFIELDSIZE_LARGE",85)
    ce.setOpt("USERAGENT","curl/7.34.0")
    ce.setOpt("MAXREDIRS",50)
    ce.setOpt("CAINFO","C:\\Program Files (x86)\\a5V12\\CARoot\\ca-cert.pem")
    ce.setOpt("CAPATH","C:\\Program Files (x86)\\a5V12\\CARoot")
    ce.setOpt("CUSTOMREQUEST","POST")
    ce.setOpt("TCP_KEEPALIVE",1)
    ce.SetOpt("FILE",cf_1)
    flag_1 = ce.Exec()

    if flag_1 then
    showvar( "Headers: "+crlf()+cf_1.GetHeaders()+crlf()+"Content:"+crlf()+cf_1.GetContent())
    else
    showvar("error: " + ce.Error() )
    end if
    ce.close()

    #2
    Re: Twilio SMS working code and question.

    Hey Rick,

    This is a tough one because you'd have to know, or get to know, Twilio in order to help. I've read a bit of the docs in Twilio... really interesting stuff, by the way... and it seems when you set up your account you can establish a StatusCallback URL... is that right? If you have that in place, and you include StatusCallback in your Twilio call, the StatusCallback in your call will be ignored.

    StatusCallback is simply set to a URL... is that right?

    Do you have StatusCallback set up in your account?

    If you don't... have you tried including StatusCallback in your call? With StatusCallback set to a valid URL... pointing to an a5w page you have? I would first create an a5w page with just a title and see it that gets called when Twilio is done... which is when the callback call is made.

    I'm probably just talking in the dark here... but that's my understanding so far.

    Comment


      #3
      Re: Twilio SMS working code and question.

      Hi Rick,

      Great work on the Twillio integration, this is something I have been looking into as well but did not get that far. Quick question, can this code be executed in an Xbasic function via Ajax call back or does it need to sit on a standalone .a5w page?

      Cheers,

      Scott

      Comment


        #4
        Re: Twilio SMS working code and question.

        I use a xbasic function.

        Comment


          #5
          Re: Twilio SMS working code and question.

          The phonegap SMS plugin is working well within the UX component.
          This was implemented by Mr. Moore last week. FYI

          I have tested and is working, meaning utilizing your own android/iphone sms plan.
          this is good for small job, like single or less than 100 recipient ? in my opinion.

          Why not give it a try ....

          Comment


            #6
            Re: Twilio SMS working code and question.

            Hi Everyone,

            The solution from Rick works great but FYI it wouldn't work for me until I commented out this line:

            ce.setOpt("POSTFIELDSIZE_LARGE",85)

            Cheers,

            Scott

            Comment


              #7
              Re: Twilio SMS working code and question.

              Scott,

              Maybe this is the same thing I ran into. You no longer have to worry about the "POSTFIELDSIZE_LARGE" setting. That was biting me as well when I was creating new code with the cURL genie. Now, Alpha creates a variable and re-calcs the field size in the code that the genie generates.

              Comment


                #8
                Re: Twilio SMS working code and question.

                I'd like to create an Alpha integration with an SMS service we provide (www.BusinessTextBox.com)

                I am familiar with Twilio and have had a couple of apps created on their platform. There are some similarities with our API so it would likely be relatively simple for those of you that have already done that.

                The key differentiator between Twilio and TextBox is that we can text-enable a business's existing land-line telephone number rather than having to introduce a different number or deal with inbound phone calls as a result of the outbound texts.

                And, since we already provide a two-way SMS interface an Alpha app could be limited to only the outbound side. (i.e. automated appointment reminders that fire based on an Alpha scheduling application) If the recipient responds, the conversation would continue in our application.

                If interested please PM me. I'd be happy to set up a test account.

                Comment


                  #9
                  Re: Twilio SMS working code and question.

                  Originally posted by Gatorfan View Post
                  I use Twilio to send SMS. This is the code and it works. You have to provide the following: Twilio SID, Token and a message. Does anyone know how to add the StatusCallback parameter and how to setup an a5w page to handle the response?

                  Thank you.

                  Rick Reeves
                  941-737-9299


                  dim cf_1 as extension::CurlFile
                  dim flag_1 as l
                  dim ce as extension::Curl

                  vTwilioURLPre="https://api.twilio.com/2010-04-01/Accounts/"
                  vSID =""
                  vTwilioURL=vTwilioURLPre+vSID+"/Messages"
                  vToken = ""
                  vPassword=vSID+":"+vToken
                  vMessage="This is a test SMS."

                  vToNumber="9415551212"
                  vTo="&To=+1"+vToNumber

                  vFromNumber="9415551212"
                  vFrom="&From=+1"+vFromNumber

                  vBody = "Body="+urlencode(vMessage)
                  vPostFields=vBody+vTo+vFrom

                  ce = extension::Curl.Init()
                  ce.setOpt("URL",vTwilioURL)
                  ce.setOpt("NOPROGRESS",1)
                  ce.setOpt("USERPWD",vPassword)
                  ce.setOpt("POSTFIELDS",vPostFields)
                  ce.setOpt("POSTFIELDSIZE_LARGE",85)
                  ce.setOpt("USERAGENT","curl/7.34.0")
                  ce.setOpt("MAXREDIRS",50)
                  ce.setOpt("CAINFO","C:\\Program Files (x86)\\a5V12\\CARoot\\ca-cert.pem")
                  ce.setOpt("CAPATH","C:\\Program Files (x86)\\a5V12\\CARoot")
                  ce.setOpt("CUSTOMREQUEST","POST")
                  ce.setOpt("TCP_KEEPALIVE",1)
                  ce.SetOpt("FILE",cf_1)
                  flag_1 = ce.Exec()

                  if flag_1 then
                  showvar( "Headers: "+crlf()+cf_1.GetHeaders()+crlf()+"Content:"+crlf()+cf_1.GetContent())
                  else
                  showvar("error: " + ce.Error() )
                  end if
                  ce.close()
                  Hello Gatorfan ,

                  This code is not working with me


                  dim cf_1 as extension::CurlFile
                  dim flag_1 as l
                  dim ce as extension::Curl

                  vTwilioURLPre="https://api.twilio.com/2010-04-01/Accounts/"
                  vSID ="AC72f029855993ab124649335691885475"
                  vTwilioURL=vTwilioURLPre+vSID+"/Messages"
                  vToken = "57f1b87d2ae8cd2b0ba8de212f9ed1e4"
                  vPassword=vSID+":"+vToken
                  vMessage="This is a test SMS."

                  vToNumber="966545555807"
                  vTo="&To=+1"+vToNumber

                  vFromNumber="2014740225"
                  vFrom="&From=+1"+vFromNumber

                  vBody = "Body="+urlencode(vMessage)
                  vPostFields=vBody+vTo+vFrom

                  ce = extension::Curl.Init()
                  ce.setOpt("URL",vTwilioURL)
                  ce.setOpt("NOPROGRESS",1)
                  ce.setOpt("USERPWD",vPassword)
                  ce.setOpt("POSTFIELDS",vPostFields)

                  'ce.setOpt("POSTFIELDSIZE_LARGE",85)

                  ce.setOpt("USERAGENT","curl/7.34.0")
                  ce.setOpt("MAXREDIRS",50)
                  ce.setOpt("CAINFO","C:\\Program Files (x86)\\a5V12\\CARoot\\ca-cert.pem")
                  ce.setOpt("CAPATH","C:\\Program Files (x86)\\a5V12\\CARoot")
                  ce.setOpt("CUSTOMREQUEST","POST")
                  ce.setOpt("TCP_KEEPALIVE",1)
                  ce.SetOpt("FILE",cf_1)
                  flag_1 = ce.Exec()

                  if flag_1 then

                  showvar( "Headers: "+crlf()+cf_1.GetHeaders()+crlf()+"Content:"+crlf()+cf_1.GetContent())


                  else
                  showvar("error: " + ce.Error() )
                  end if
                  ce.close()



                  the error am getting :
                  Error executing Ajax callback. Error executing Ajax callback function 'sendSMS ': command: showvar( "Headers: "+crlf()+cf_1.GetHeaders()+crlf()+"Content:"+crlf()+cf_1.Ge Function: 'not_valid' was not recognized



                  do you have any idea or can any one help me solving this ??

                  Regards
                  To live anywhere in the world today and be against equality because of race or color is like living in Alaska and being against snow.�

                  - William Faulkner

                  Comment


                    #10
                    Re: Twilio SMS working code and question.

                    Originally posted by aal_fareed View Post
                    Hello Gatorfan ,

                    This code is not working with me


                    dim cf_1 as extension::CurlFile
                    dim flag_1 as l
                    dim ce as extension::Curl

                    vTwilioURLPre="https://api.twilio.com/2010-04-01/Accounts/"
                    vSID ="AC72f029855993ab124649335691885475"
                    vTwilioURL=vTwilioURLPre+vSID+"/Messages"
                    vToken = "57f1b87d2ae8cd2b0ba8de212f9ed1e4"
                    vPassword=vSID+":"+vToken
                    vMessage="This is a test SMS."

                    vToNumber="966545555807"
                    vTo="&To=+1"+vToNumber

                    vFromNumber="2014740225"
                    vFrom="&From=+1"+vFromNumber

                    vBody = "Body="+urlencode(vMessage)
                    vPostFields=vBody+vTo+vFrom

                    ce = extension::Curl.Init()
                    ce.setOpt("URL",vTwilioURL)
                    ce.setOpt("NOPROGRESS",1)
                    ce.setOpt("USERPWD",vPassword)
                    ce.setOpt("POSTFIELDS",vPostFields)

                    'ce.setOpt("POSTFIELDSIZE_LARGE",85)

                    ce.setOpt("USERAGENT","curl/7.34.0")
                    ce.setOpt("MAXREDIRS",50)
                    ce.setOpt("CAINFO","C:\\Program Files (x86)\\a5V12\\CARoot\\ca-cert.pem")
                    ce.setOpt("CAPATH","C:\\Program Files (x86)\\a5V12\\CARoot")
                    ce.setOpt("CUSTOMREQUEST","POST")
                    ce.setOpt("TCP_KEEPALIVE",1)
                    ce.SetOpt("FILE",cf_1)
                    flag_1 = ce.Exec()

                    if flag_1 then

                    showvar( "Headers: "+crlf()+cf_1.GetHeaders()+crlf()+"Content:"+crlf()+cf_1.GetContent())


                    else
                    showvar("error: " + ce.Error() )
                    end if
                    ce.close()



                    the error am getting :
                    Error executing Ajax callback. Error executing Ajax callback function 'sendSMS ': command: showvar( "Headers: "+crlf()+cf_1.GetHeaders()+crlf()+"Content:"+crlf()+cf_1.Ge Function: 'not_valid' was not recognized



                    do you have any idea or can any one help me solving this ??

                    Regards
                    help any one?
                    To live anywhere in the world today and be against equality because of race or color is like living in Alaska and being against snow.�

                    - William Faulkner

                    Comment


                      #11
                      Re: Twilio SMS working code and question.

                      finally its working ,

                      use this code for twillio integration by using the node.js

                      but remember you have to install twillio modular in
                      C:\Program Files (x86)\a5V12\

                      you can do that by downloading the modular from twillio.com or github.com
                      after that use the npm install command to install the modular .

                      then place a button in a dialog
                      2 text box as one for mobile and the other textbox for the SMS body msg .

                      ajax call on the button
                      place this code within your xbasic ajax
                      simple & clean

                      debug(1)
                      dim n as helper::V8
                      dim p as p
                      p._id = api_uuidcreate()
                      p._command = "sendsms"
                      ' \\ you can change the phone number and msg in below line
                      p.phone = "+966545555807"
                      p.msg = "Message1"

                      dim jsoncmd as c
                      jsoncmd = json_generate(p)
                      txt = n.NodeRequest(jsoncmd)


                      also sendSMS.JS is the trick

                      please click here to download it
                      and then paste it in this path
                      C:\Program Files (x86)\a5V12\node_services

                      it took three working dats to get this working so i thought about sharing it to save someones time
                      btw this is working with pre release version too & dont forget to enable geo location in your twilio account

                      good luck all
                      Last edited by aal_fareed; 02-04-2016, 04:55 PM.
                      To live anywhere in the world today and be against equality because of race or color is like living in Alaska and being against snow.�

                      - William Faulkner

                      Comment


                        #12
                        Re: Twilio SMS working code and question.

                        Anyone here sending batch (multiple) messages at once using Twilio?
                        Mike Brown - Contact Me
                        Programmatic Technologies, LLC
                        Programmatic-Technologies.com
                        Independent Developer & Consultant​​

                        Comment


                          #13
                          Re: Twilio SMS working code and question.

                          Originally posted by mikeallenbrown View Post
                          Anyone here sending batch (multiple) messages at once using Twilio?


                          I have a ready integrated component that achieve this

                          I'll find it tomorrow and upload it for u
                          To live anywhere in the world today and be against equality because of race or color is like living in Alaska and being against snow.�

                          - William Faulkner

                          Comment


                            #14
                            Re: Twilio SMS working code and question.

                            After giving it some more thought I refined my methodology and it looks like I got something that'll work.

                            I'd still be interested in what you came up with. Thank you very much for your generosity.
                            Mike Brown - Contact Me
                            Programmatic Technologies, LLC
                            Programmatic-Technologies.com
                            Independent Developer & Consultant​​

                            Comment


                              #15
                              Re: Twilio SMS working code and question.

                              Tried to send a SMS through Nexmo using the Node method that Ahmed showed here, but didn't work. The sendsms.js file is no longer available for download and i don't know what to change exactly...If anyone has experience with this method and/or with Nexmo please share.
                              https://www.nexmo.com/blog/2016/10/1...nd-express-dr/

                              Comment

                              Working...
                              X