Message Boards Message Boards

Use Twilio ServiceConnect to send messages via a Cloud FormFunction?

Posted 5 years ago

Hello WL community,

I have a very simple web app I'm creating for my building. One of the goals is to notify residents on the same floor about laundry events - e.g. you left your clothes in the washer, etc.

I'm using the Twilio service which I can connect with no problem and send text messages with. So I created a function that simply takes a floor and message and via a dataset picks the phone numbers for that floor and sends them the text message. Simple.

Twilio setup

twilio=ServiceConnect["Twilio"]

Messaging function:

sendLaundryMessageTwo[laundryMessageTwo_,laundryFloorTwo_]:= For[i=0;z=residents[Select[#Floor == laundryFloorTwo&], "Phone"], i<Length[z], i++; sendLaundryEvent[z[i],laundryMessageTwo]]

Web form:

CloudDeploy[FormFunction[{"bmessage"->"TextArea","bfloor"->"Number"},sendLaundryMessageTwo[#bmessage, #bfloor] &]]

Now the problem: If I use the function from the cloud notebook like this it all works and sends txt messages are received:

sendLaundryMessageTwo["Hello",3]

But when I fill in the web form and I submit all I get is a blank page with a just a footing that says "Powered by Wolfram Cloud." No debugging info, status or anything. I don't have access to the Desktop version of WL/Mathematica so I can't test it there but I find it surprising that when used via Wolfram Cloud no feedback is given in situations like this.

Have you experienced this before? Any suggestions? Should the app be structured differently?

Thanks, Jose

POSTED BY: Jose M.

Hi Jose, sorry this answer comes so late.

I think the problem is that the connection is not properly stored in the Wolfram Cloud. In version 12.3 we introduced new ways to use the Authentication option so you should be able to use ServiceConnect with the Authentication option to pass your credentials.

Let me know if that works or if you have more questions.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract