Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Last active October 12, 2023 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamoCA/c7cdeaf9842c6233fe8e55b0c37642d5 to your computer and use it in GitHub Desktop.
Save JamoCA/c7cdeaf9842c6233fe8e55b0c37642d5 to your computer and use it in GitHub Desktop.
Basic ColdFusion example to post an audio file to Deepgram's "listen" API to transcribe audio files. #cfml
<!---
2023-10-12 Basic ColdFusion example to post an audio file to Deepgram's "listen" API to transcribe audio files
Gist: https://gist.github.com/JamoCA/c7cdeaf9842c6233fe8e55b0c37642d5
Adobe Community Post: https://community.adobe.com/t5/coldfusion-discussions/help-converting-curl-to-cfhttp/m-p/14152562
Deepgram documentation: https://developers.deepgram.com/docs/transcribing-pre-recorded-audio
My Twitter: https://twitter.com/gamesover
--->
<cfscript>
myApiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
myFilePath = "c:\myimage.mp3";
fileData = filereadbinary(myFilePath);
cfhttp(method="post", url="https://api.deepgram.com/v1/listen?model=nova-2-ea&smart_format=true") {
cfhttpparam(type="header", name="Authorization", value="Token #myApikey#");
cfhttpparam(type="header", name="Accept", value="application/json");
cfhttpparam(type="header", name="Content-Type", value="#fileGetMimeType(myFilePath)#");
cfhttpparam(type="body", value="#fileData#");
}
cf_dump(var=cfhttp);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment