cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AlexJohnH
Regular Visitor

SMS PowerApp with Twilio connector

Hello,

 

I'm wanting to integrate Twilio in to a Power App - I've been doing some testing and need some assistance.

 

Essentially I'm wanting to design a Power App whereby the end user clicks a 'Send SMS' button and is then prompted to enter the text they'd like to send in the SMS message. Also, I'm not sure if it's possible to add a list of numbers that the message will go to in Twilio.

 

Thanks in advance

Alex

1 ACCEPTED SOLUTION

Accepted Solutions

@AlexJohnH 

You can add all recipients to one multiline textbox and loop through it like this:

ForAll(Filter(MatchAll(YourMultiLineTextInput.Text,"(.*)",MatchOptions.Multiline),FullMatch<>""),Twilio.SendMessage("15552603109",FullMatch,"Hello, World!"););

The numbers will need to be on their own line of the textbox. 

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

View solution in original post

13 REPLIES 13
EricLott
Super User
Super User

Yes, this is all possible. You'll just need to setup a Power Automate job that accepts a message input from PowerApps, runs a Twilio Send Message command and optionally returns a result to PowerApps.
For multiple numbers, you can send those in one batch like a group message using a semicolon separator or loop through the numbers using ForAll() in PowerApps or Apply to Each in Power Automate.

There is also a Twilio connector built straight into PowerApps, but it gives a little less control (last time I used it, which was a couple months ago). It should be straight forward, but if you have a specific question about that let me know.

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

eka24
Super User III
Super User III

You can also follow this post. It deals with it.
https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-send-a-Text-Message/m-p/138983#M47890
Also watch:
https://youtu.be/9x3aJkV0s1Q

If you like this post, give a thumbs up. Where it solved your issue, Mark as a solution

Thanks for coming back to me. Just need some assistance with getting a text input from Power Apps that will in turn be the Twilio message.

 

For instance the user will access the power app and see a 'Send SMS' button. Once they click on this button  it should prompt the user to enter the text that will be used for the Twilio SMS.

@AlexJohnH 

Here is a great resource for adding a popup in PowerApps, which you can use for your textinput control. In their example, they add a label for a confirmation, but you can just use a textinput with cancel/send buttons.

Your formula would then look like this

Twilio.SendMessage(fromNumber,toNumber,TextInput1.Text)

@EricLott 

 

Sorry, I cannot see the resource you're referring to? Although, I've just added the text input in to a new screen - so would be helpful to reference that resource to get the formula correct.

@AlexJohnH 

I guess it would help if I added the link..

https://www.youtube.com/watch?v=_Dc0wJx9EN0

@EricLott 

 

Thanks for that, quite an intuitive video. Right, so I have the below formula:-

 

Twilio.SendMessage(fromNumber,toNumber,TextInput1.Text)

 

You'll have to excuse me but this is my first time using the Twilio connector in conjunction with Power Apps, so how do I actually input the from/to number int to the formula? 

@AlexJohnH 

You can either hard-code it like this

Twilio.SendMessage("15551234567","15557654321",TextInput1.Text)

Or set the variable values like this in your App's OnStart property, your form's OnVisible property, or any other property that begins with "On..."

Set(fromNumber,"15551234567");
Set(toNumber,"15551234567");

 Or if you'd like another text input for the to/from numbers, you can add those the same way you did the message text.

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

@EricLott 

 

That's great. I've set the from/to numbers using the App OnStart property - so those are now specified and seem to be fine. The only issue I'm having now is that it's not liking the text input.

 

Twilio.SendMessage(fromNumber,toNumber,'SMS Text Input')

 

I'm entering the text that I'd like the SMS to read but it's failing. The App checker is claiming that 'Twilio.SendMessage failed: The method 'SendMessage' has an invalid value for the parameter 'From'.

 

Location Button5.OnSelect

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,485)