SMS with personal questionnaire link

52 views
Skip to first unread message

CaroM

unread,
Apr 8, 2021, 6:52:01 AM4/8/21
to formr
Hi,

We want to use SMS to send personal questionnaire links to our participants. I use External link module for this (script below). For some reason, when adding personal link, the section sends out two SMS-s instead of one.
The link in the first SMS takes participant to the formr homepage (not the questionnaire). When the second SMS comes through (in 10-20 seconds), then the link in both SMS-s takes participant to the personal questionnaire. (so, in a way, it works, but causes a lot of confusion with the two SMS-s and one temporarily not working properly).
When I replace the SMS text with just "Hello world!" instead of personal link, it sends out one SMS.
So, something happens regarding the study link/personal link causing send-out of 2 SMS-s. According to the local provider we are not exceeding the character limit of SMS (although the personal link is long, it does not exceed 160 chars, and no special characters are used).
Any tips what might be the cause of the problem?


The function used in External link module is following:

library(httr)

text_message_directmessenger = function(Sender, Receiver, Smstext, Token, return_result = F) {
    request = httr::POST("https://api.messenger.ee/api",
        httr::add_headers(`Content-Type` = "application/json",  accept = "application/json"),
        body = paste0("{
            \"api_token\":\"", Token, "\",
            \"smstext\":\"", Smstext, "\",
            \"receiver\":\"", Receiver, "\",
            \"sender\":\"", Sender, "\"
        }")
    )
    response = httr::content(request)
    if (return_result) {
        response
    } else {
        if (request$status_code < 300) {
            TRUE
        } else {
            FALSE
        }
    }
}
 

 
text_message_directmessenger(Sender="Institute", Receiver = paste0("372",consent$subj_mobile, sep=""), Smstext = paste0("http://carotest4.formr.org/?code=", survey_run_sessions$session), Token = "TokenTokenToken", return_result = F)

All the best,
Carolina

Carolina Murd

unread,
Apr 9, 2021, 5:58:51 AM4/9/21
to formr
**SOLVED!**

There was a "FALSE" missing from the very end of the function.

All the best,
Carolina

--
You received this message because you are subscribed to the Google Groups "formr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to formr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/formr/be2304be-dc6b-417d-a69d-3dae6d60f376n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages