Making a call using ColdFusion and the Twilio REST API

November 23, 2008
Written by
Twilio
Twilion

This post is part of Twilio’s archive and may contain outdated information. We’re always building something new, so be sure to check out our latest posts for the most up-to-date insights.

Twilio Bug Logo

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>