---title: Sending a Recording Transcription via SMSslug: /guides/transcription-to-textsidebar_position: 17x-custom: ported_from_readme: true needs_review: true---import Tabs from @theme/Tabs;import TabItem from @theme/TabItem;Overview--------This code snippet uses transcription status callbacks in order to send a transcription of the created recording via SMS. When a recording is created with transcription enabled and the transcription callback pointing to this script, a SignalWire client object will be created and used to send the message to the end destination cell phone.You can learn more about transcription status callbacks, all of the possible parameters you can learn, and how to set them up in our [status callback mega guide](/guides/signalwire-status-callbacks#transcription-status-callbacks)! Full code example: Transcription to SMS
python@app.route(/message, methods=[POST])def message(): call_sid = request.form.get(CallSid) transcription_text = request.form.get(TranscriptionText) from_number = request.form.get(From) client = signalwire_client(ProjectID, AuthToken, signalwire_space_url = YOURSPACE.signalwire.com) m = client.messages.create( body=You have received a voicemail from the number + from_number + . The voicemail transcription is as follows: + transcription_text + and the Call SID is + call_sid, from_=+1xxxxxxxxxx, to=+1xxxxxxxxxx ) return transcription_textjsconst express = require(express)const { Messaging } = require(@signalwire/realtime-api)var app = express();app.use(express.urlencoded());app.listen(process.env.PORT || 3000, () => { console.log(Server running on port 3000);});let project_id = XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX;let access_token = PTxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxconst client = new Messaging.Client({ project: project_id, token: access_token, })app.post(/message, (req, res, next) => { console.log(req.body) let call_sid = req.body.CallSid let transcription_text = req.body.TranscriptionText let from_number = req.body.From client.send({ body: You have received a voicemail from the number + from_number + . The voicemail transcription is as follows: + transcription_text + and the Call SID is + call_sid, from: +###########, to: +########### })}) Python------This script is short and simple. There is only one route in this application which we will call /message.### What do I need to run this code?You will need the Flask framework and the SignalWire [Python SDK](pathname:///compatibility-api/rest/overview/client-libraries-and-sdks#python) downloaded.### How to Run Snippet?To run the application, execute export FLASK_APP=your_file_name.py then run flask run.### Code WalkthroughWe need to use request.form.get(ParameterName) in order to gather the CallSid, TranscriptionText, and From number parameters and store them in their own variables. If you want to include more parameters either to print to console or include in the message, you can gather them using the same format here. We then create a SignalWire client object with our project details and authentication. All thats left there is to create a message object and send all of the necessary information within the Body with the To number being the end destination number and the From number being a SignalWire number. python@app.route(/message, methods=[POST])def message(): # gather necessary paramters and store them in an accessible variable call_sid = request.form.get(CallSid) transcription_text = request.form.get(TranscriptionText) from_number = request.form.get(From) # create a client object connected to our account & project client = signalwire_client(ProjectID, AuthToken, signalwire_space_url = YOURSPACE.signalwire.com) # create a text message and the text with necessary parameters m = client.messages.create( body=You have received a voicemail from the number + from_number + . The voicemail transcription is as follows: + transcription_text + and the Call SID is + call_sid, from_=+1xxxxxxxxxx, to=+1xxxxxxxxxx ) return transcription_textNode.js-------### What do I need to run this code?We will need the following libraries (click their names to get instructions on how to install them):- [Express](https://www.npmjs.com/package/express)- [SignalWire Realtime Client](https://www.npmjs.com/package/@signalwire/realtime-api)### How to Run Snippet?If you save this code snippet in a file called recordingTranscriptionViaSMS.js, for example, you then need to run: node recordingTranscriptionViaSMS.js.### Code Walkthrough#### Load the necessary librariesjavascriptconst express = require(express)const { Messaging } = require(@signalwire/realtime-api)#### Instantiate ExpressIn this section we create and launch Express, to then have it listen for requests on port 3000.javascriptvar app = express();app.use(express.urlencoded());app.listen(3000, () => { console.log(Server running on port 3000);});#### Set your SignalWire CredentialsIn order for us to connect to SignalWire later on in the code using the Rest Client we first need to make sure we update project_id and access_token.javascriptlet project_id = XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX;let access_token = PTxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx#### Instantiate the SignalWire ClientSince were just going to be sending messages, there is no need to specify the Relay context.javascriptconst client = new Messaging.Client({ project: project_id, token: access_token, })#### Expose the /message endpointHere we expose the /message endpoint, that will solely respond to POST requests, and outline the actions to take when one comes in.We gather the call_sid, transcription_text, and from_number from the request body. We then create a message with the body making use of the data gathered from the request, using FROM and TO numbers of our liking.javascriptapp.post(/message, (req, res, next) => { console.log(req.body) let call_sid = req.body.CallSid let transcription_text = req.body.TranscriptionText let from_number = req.body.From client.send({ body: You have received a voicemail from the number + from_number + . The voicemail transcription is as follows: + transcription_text + and the Call SID is + call_sid, from: +###########, to: +########### })})Wrap up-------It is very simple to send a particular recordings transcription via SMS, and it doesnt take a lot of code to accomplish this functionality either!Sign Up Here------------If you would like to test this example out, you can create a SignalWire account and space [here](https://m.signalwire.com/signups/new?s=1).Please feel free to reach out to us on our [Community Slack](https://signalwire.community/) or create a Support ticket if you need guidance!