Making a call using ColdFusion and the Twilio REST API
Time to read: less than 1 minute
Several people have asked for an example for initiating a call using ColdFusion and the Twilio Voice API. Here you go! Replace the parameters in the cfset statements, of course.
<!— Start a call from coldfusion —>
<!— enter your information for the following parameters —>
<cfset accountSid=”yourAccountSid”>
<cfset secret=”yourSecretKey”>
<cfset caller=”yourVerifiedCallerId”>
<cfset called=”phonenumberToCall”>
<cfset action_url=”urlToExecute”>
<!— make the rest request —>
<cfhttp url=”https://api.twilio.com/2008-08-01/Accounts/#accountSid#/Calls”
method=”POST”
username=”#accountSid#”
password=”#secret#”>
<cfhttpparam name=”Caller” type=”FormField” value=”#caller#”>
<cfhttpparam name=”Called” type=”FormField” value=”#called#”>
<cfhttpparam name=”Url” type=”FormField” value=”#action_url#”>
</cfhttp>
<!— display results —>
<cfoutput>
HTTP Response = #cfhttp.statusCode# <br>
<textarea cols=80 rows=10>
https://api.twilio.com/2008-08-01/Accounts/#accountSid#/Calls
#cfhttp.fileContent#
</textarea>
</cfoutput>
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.