How To Send a Text Message in PowerApps
There are two ways to send a text message in PowerApps. Each has its pros and cons. In this post I will explain and show you both methods on how to send a text message in PowerApps. Continue reading and you too will become an Office Power User!
Method Using the Launch Function
PROS: No third party provider needed. Easy to implement. No additional costs.
CONS: Need separate button for IOS and Android, The message does not automatically send in the background it simply launches the default text app on device. The text is sent using the users personal phone number.
- Text Input
- Name: txtNumber
- Text Input
- Name: txtMessage
- Text: “Launch IOS”
- OnSelect: Launch(“SMS:” & txtNumber.Text & “&body=” &txtMessage.Text)
- Text: “Launch Android”
- OnSelect: Launch(“SMS:” & txtNumber.Text,”body”,txtMessage.Text)
Method Using Flow and Twilio
PROS: One call for both IOS and Android. User stays in the app and text runs in background. Dedicated number for app.
CONS: A little more complicated to implement. Adds costs to app. Need third party (Twilio).
Create a Twilio Account
You can create a free trial account for this demo. Twilio is a relatively inexpensive service to send messages. You pay $1 a month for a phone number and $.007 per text.
- Twilio Account Id: ********************
- Twilio Access Token *************************
Create a Flow
Start a new flow that uses PowerApps as the trigger. This flow will use the Twilio connector. You will need your account id and access token from above to authenticate.
- Name: SendTextWithTwilio
- From Phone Number: User number giving from Twilio setup.
- To Phone Number: “Ask in PowerApps”
- Text: “Ask in PowerApps”
Connect Flow to PowerApps
Now back into PowerApps you attach the flow to a button to send the text. You connect to the flow by using the action menu and selecting Flow. If the flow code that is generated is not in your button OnSelect and is placed elsewhere cut it out and pasted it in the OnSelect of the button mentioned below.
- Text: Flow with Twilio
- OnSelect: SendTextWithTwilio.Run( txtNumber.Text , txtMessage.Text )
Now you know how to send a text message with PowerApps! Please leave your feedback. I hope this article has been helpful for you so bookmark this blog as new articles are posted regularly.