Hey all, what is the best way to send SMS with CF?...
# cfml-general
Hey all, what is the best way to send SMS with CF? if it is Twilio, is that simple to setup? is there already CF components created to use Twilio if that is the best....how easy it is to se up twilio? IF Twilio not the best, what might be best.....THANKS
There are several packages https://www.forgebox.io/?search=twilio
Best is a relative term I have used AWS - SNS and Twilio.
@aliaspooryorik Yeah I have seen those...Is Twilio the best way to send SMS, or is there something better?
@Michael Schmidt maybe best was a bad choice...easiest, or most common would be better
Depends what you mean by "better". AWS has SNS if you're already using AWS or there are services like clickatell which I've used before. It depends on a lot of factors like volume / tiers, which countries you are sending to, do you need to handle replies, do you need your own sendcode etc?
And just a warning that the world of Automatic System Messaging gets more difficult all the time. (And not normally caused on the technical side) So be prepared for a ride that won't always stay the same.
yeah - different countries have different laws, so for example you may find when you can send the SMS is restricted etc (depending on what the SMS is about)
All client wants to send out SMS messages....uses SendGrid for emails, so he thought Twilio would be best...never done this so checking in....need to figure out how much Twilio is to send messages....and set up...is it easy
If I read the client info right I think it is a US company only....
it's where the person getting the SMS is a citizen of.
We use Twilio at work for SMS. Does the job just fine for us. They have a Java helper lib that interfaces their API. CF should be able to make use of that. In our case we actually have an internal Java lib that wraps it and ends up being the middleman between CF and the Twilio lib, so I can't speak to the efforts for having CF use it directly.
@tonyjunkes Hey, I see a few items in Forgebox like cftwilio....looks simple either way....Clients uses SendGrid to send emails which is a twilio company...not sure how to set up twilio, maybe with sendgrid account...not sure how many SMS messages need send out so do you have a rough cost per month?
We've used Twilio for years and it hasn't changed too much. You have to have an outgoing phone number, which is a small fixed cost, and then you pay per message. More complicated (though not a ton) if you want to accept and process replies.
3/4 of a cent per message outgoing
I'm not sure about if you can use the sendgrid account. We also use them for email, but when we set up email and sms, they were still separate companies so 2 accounts. No idea if that's changed for us.
@sknowlton Hey, thought that was it from what i read...simple one time cost for the twilio phone number and the about 3/4 cent per message....
@tonyjunkes thanks...can't find anything on sendgrid yet that tells me the accounts can be used together....
I’ve used twilio as well, their API is simple enough that you can just do a
call if your use case is also simple enough…
Pretty much as simple as this:
Copy code
<cfset accountID = "x">
<cfset authToken = "y">
<cfset to = "+15555555555">
<cfset from = "+15555555555">
<cfset body = "My text message">
<cfhttp result="result" 
    <cfhttpparam name="to" type="formfield" value="#to#">
    <cfhttpparam name="from" type="formfield" value="#from#">
    <cfhttpparam name="body" type="formfield" value="#body#">
<cfdump var="#result#">
There are probably 100+ services out there like twilio, so it comes down to pricing, country support, api, etc as others have mentioned - Twilio is certainly one of the most popular choices.
@foundeo thanks for this information...seems like I just need to get the client to understand they need a twilio phone number and pay 3/4 cent per SMS....and the code you posted should not take too long to add to a component....
I use twilio-sdk. It's on forgebox.io Easy to setup.
@foundeo hey, your twilio code has been a great help for me so far....I am wondering if you have ever set up a scheduledType for twilio to send info to it and have twilio store the info and send it out at a later date? that is what I am checking on now...
No, sorry I haven’t used that feature
no problem....just thought I'd check....