Generating SMS Messages


Once you have your gateway defined, it is time to write your first SMS application and start sending some text messages. For the time being, let's put this in a test file:

 <cfscript>         msg = structNew();          msg.command = "submit";          msg.destAddress = "5551234";          msg.shortMessage = "Hi from ColdFusion!";            ret = sendGatewayMessage("Helpdesk - 5551212", msg);  </cfscript> 

It is nice to note that this will work and send out our text message even though we have not written any code inside our gateway CFC yet.

One of the benefits of the SMS gateway over the IM gateway is the ability to send the same message to multiple people. There is an additional submit command called 'submitMulti' which will allow you to create a message that will go to multiple users:

 <cfscript>          destAddress = ArrayNew(1);         ArrayAppend(destAddress,"+44 7880 333555");         ArrayAppend(destAddress,"+49 173 666 5555");         ArrayAppend(destAddress,"+1 248 777 5555");                  msg = structNew();          msg.command = "submitMulti";          msg.destAddresses = destAddress;          msg.shortMessage = "Hi from ColdFusion!";            ret = sendGatewayMessage("Helpdesk - 5551212", msg);  </cfscript> 

NOTE

The gateway will only accept the destination addresses as an array, so you will need to convert any database queries to an array.




Advanced Macromedia ColdFusion MX 7 Application Development
Advanced Macromedia ColdFusion MX 7 Application Development
ISBN: 0321292693
EAN: 2147483647
Year: 2006
Pages: 240
Authors: Ben Forta, et al

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net