Closed s-espinosa closed 7 years ago
Added tests and refactored Sms::UsersController
to avoid deprecation warning.
@case-eee Implemented change to default a user's active
status to false.
sms
route/controller name? I don't think it'll be terribly difficult to update, but wasn't sure where you came out on that. Let me know! 🎉 @case-eee Adjusted the routes from /sms/users
to /messaging/twilio/users
per conversation above. Let me know what you think!
@s-espinosa I think this looks good!
@case-eee Believe this is consistent with the behavior we discussed regarding allowing a user to unsubscribe via text if someone had entered a wrong number, etc.
One note: I found that sending
unsubscribe
back to these messages triggers something on the Twilio side to not allow the app to send messages to a particular phone number. Twilio still sends that info through to our app in a POST request, so I'm deactivating the users on our side as well, but that may be slightly duplicative. Seems that this functionality is built into Twilio to some degree, but still saves us from attempting to send the daily SMS and gives us an accurate count of active users.Primary Changes
/sms
route,Sms::BaseController
, andSms::UsersController
to handle post requests from Twilio.update
method toSms::UsersController
to changeactive
to false on a user if they textno
orunsubscribe
.Secondary Changes
deactivate
method from Twilio service.before_save
to user to clean incoming phone numbers to be consistent with how Twilio sends them so they can be used in afind_by
on theSms::UsersController
.binding_of_caller
gem to dev environment to allow IRB like access on error views.Questions
before_save
to clean a phone number on User? Planning to work on a test for this, but wondering if you had any comments.Sms::BaseController
/`Sms::UsersController? Might be overkill, but felt like a familiar way to expose what is essentially an API. Didn't want to mix this functionality with the existing site controllers.Let me know what you think!