Sending a text message (SMS) or email from a form in Collect

odk-collect
form-design

(Hélène Martin) #1

In the ODK Collect v1.16 Beta thread, @Fabla brought up that it would be useful not just to add SMS as a way to send forms but also to send messages from the form to do things like thank participants.

I believed this was already possible using the external app feature but it turns out that's not true. While that feature allows us to launch different applications and to pass special values called Android extras to them, the android.intent.action.SENDTO message requires knowing who to send the messages to and that's not done through extras.

I think this would be very useful to add. See this sample form for how I imagine it being used (doesn't work in Collect today).

The narrowest way I can think of supporting this in Collect is to introduce a special key in the parameter list that allows the form designer to specify a recipient(s). I would like to propose uri_data as its name since that is unlikely to already be part of forms and because it matches what it will represent from an Android perspective (see data in https://developer.android.com/reference/android/content/Intent).

I have a pull request up at https://github.com/opendatakit/collect/pull/2351 for any devs who might have ideas.


Can I send an SMS each time a data collector sends a form?
Ability to email finalised form as either PDF or email body, with attachments
Send phone number to dialer widget?
ODK Collect v1.16 Beta
(DavidM) #2

A similar use case would be useful for email. It would be great to be able to send the completed form to the subject at the point of completion, so that they have a record of what they just filled in.


(Yaw Anokwa) #3

@LN I like this feature idea! Is the code as written in your PR support email or is it just SMS?


(Hélène Martin) #4

It works for email as well! Both are in the sample form.


(DavidM) #5

Sorry LN
I should have actually checked the form first!
As always recently, amazed at the progress you guys are making!


(Yaw Anokwa) #6

This feature has shipped in ODK Collect v1.16.


(Abdul-Majeed) #7

Hi @LN, great work done, i just have a test of the form and i was thinking the message in the calculation field ("Thank you, ", ${name}, "! We can't wait to see you on the study start date.") is the one which will be send to the person's number, when you enter the number and click on lunch it will link you to the phone's sms tab with that phone number and the message box will be empty, i was thinking when you click on lunch it will auto send Thank you Helene! We can't wait to see you when the study start. to the person's phone number.

thank you.


(Yaw Anokwa) #8

The Intents method that we use to send these message doesn't allow auto-send.

To support your request, I think we'd have to build SMS and email sending inside the Collect app and that adds a lot more code complexity to the app.

I think we should wait and get more feedback from users about the current behavior before adding complexity. What do others think?


(Abdul-Majeed) #9

@yanokwa, this is a good idea,


(Hélène Martin) #10

Thanks for trying it out @Fabla, your feedback is always appreciated!

I totally understand the desire to send directly from Collect. The challenge is handling error cases, providing meaningful feedback to the user and enabling re-submission. As @yanokwa said, it can quickly get complicated. Using the default text messaging or email app ensures that all of those details are correctly taken care of. All that to say I agree with gathering a bit more feedback and seeing if there’s high demand or more ideas on the approach.


(Chrissy h Roberts) #11

Just to add to this thread a use case for email capability, though perhaps at Aggregate end and not on devices.

  1. I have a form (let's say it is a form to request a new account) on ODK aggregate. This form might only be filled very occasionally, either by ODK Collect or more likely on Enketo - feeding in to an Aggregate back end.

  2. I don't want to have to look every day to see if anyone has submitted any new requests, so would like to get an email saying "You've got a new submission to form x"

  3. For legal purposes I want to also send a confirmation to the person filling the form in which says "Thanks for filling in this form" and optionally "here's a copy of what you just said in the form".

In practical terms this might mean that XLSForm needs two new variable types in settings sheet i.e. notify.owner which takes an email address and some text to form the body and subject of message to owner of form. also notify.respondent which does the same but for the person filling in the form.

Neither behaviour specifically needs ODK Collect to do the heavy lifting on the email side as the server can do that part, which presumably is easier to set up.


(Abdul-Majeed) #12

I love this idea, I hope that people will contribute to make this happen in ODK