Answers.Body: <p>Used CiviRules to do this.</p>
  <p>This switches the Do Not SMS flag to ON if they reply STOP:
  <a href="https://i.sstatic.net/OyKmK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OyKmK.png" alt="enter image description here" /></a></p>
  <p>This switches the Do Not SMS flag to OFF if they reply START:</p>
  <p><a href="https://i.sstatic.net/AcR88.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AcR88.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-30T23:59:33.713Z
Answers.Text: Very nice Guy! Slick. I used Activity details is an exact match to condition just in case a reply back contains stop and start and they aren't intending to opt in or out. It is case insensitive.
Answers.UserDisplayName: Andy Burns
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-01T13:46:28.730Z
Answers.Text: Thanks Andy. I am surprised the Twilio extension doesn’t have this capability built in.
Answers.UserDisplayName: guyiac
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-31T17:46:02.720Z
Answers.Text: The Twilio extension does have this capability built-in now.
Answers.UserDisplayName: guyiac
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-30T20:45:58.920Z
Answers.LastActivityDate: 2021-07-30T20:45:58.920Z
Answers.UserDisplayName: guyiac
Answers.Body: <p>It's probably possible to do via an extension, e.g. something similar to <a href="https://civicrm.org/extensions/auto-reply-twilio-sms" rel="nofollow noreferrer">https://civicrm.org/extensions/auto-reply-twilio-sms</a></p>
  <p>Otherwise there is a generic &quot;inbound&quot; function that handles incoming sms if the provider lets you set up a callback, e.g. <a href="https://docs.civicrm.org/user/en/latest/sms-text-messaging/set-up/#setting-up-your-new-mobile-phone-number-in-twilio" rel="nofollow noreferrer">twilio setup</a>, and it's implemented in civi via <a href="https://github.com/civicrm/civicrm-core/blob/60080668785d1e389bd81260bb13210b428f224f/CRM/SMS/Provider.php#L193" rel="nofollow noreferrer">this code</a> and individual sms provider extensions can use it <a href="https://github.com/civicrm/org.civicrm.sms.twilio/blob/c324f44365c5fc886d2564891555cd46a00c739f/org_civicrm_sms_twilio.php#L189" rel="nofollow noreferrer">like this</a>.</p>
  <p>So it seems possible to implement something generic.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-27T15:19:57.097Z
Answers.LastActivityDate: 2020-10-27T15:19:57.097Z
Answers.UserDisplayName: Demerit
Body: <p>Most SMS providers allow you to respond with STOP to indicate that you no longer want to receive SMS messages. If we try to send another message to a phone number that has replied with STOP, it won't go out.</p>
  <p>However, it's not clear how this information gets back to CiviCRM, if at all. Does this have to be handled on a per SMS provider basis? Or should we be building a more generic framework to support all SMS providers? Or is there a way I haven't figured out?</p>
  <p>For reference - here's how Twilio handles it: <a href="https://support.twilio.com/hc/en-us/articles/223134027-Twilio-support-for-opt-out-keywords-SMS-STOP-filtering-" rel="nofollow noreferrer">https://support.twilio.com/hc/en-us/articles/223134027-Twilio-support-for-opt-out-keywords-SMS-STOP-filtering-</a></p>
  
Tags: <sms><twilio>
Title: How to convert a STOP message sent to an SMS provider into the "Do not SMS" privacy preference in CiviCRM?
ThreadText: # How to convert a STOP message sent to an SMS provider into the "Do not SMS" privacy preference in CiviCRM?
  
  (Asked by: username_0 on 2020-10-27)
  
  Most SMS providers allow you to respond with STOP to indicate that you no longer want to receive SMS messages. If we try to send another message to a phone number that has replied with STOP, it won't go out.
  
  However, it's not clear how this information gets back to CiviCRM, if at all. Does this have to be handled on a per SMS provider basis? Or should we be building a more generic framework to support all SMS providers? Or is there a way I haven't figured out?
  
  For reference - here's how Twilio handles it: <https://support.twilio.com/hc/en-us/articles/223134027-Twilio-support-for-opt-out-keywords-SMS-STOP-filtering->
  
  **Tags:** sms, twilio
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-07-30. Score: 3
  
  Used CiviRules to do this.
  
  This switches the Do Not SMS flag to ON if they reply STOP:
  [![enter image description here](https://i.sstatic.net/OyKmK.png)](https://i.sstatic.net/OyKmK.png)
  
  This switches the Do Not SMS flag to OFF if they reply START:
  
  [![enter image description here](https://i.sstatic.net/AcR88.png)](https://i.sstatic.net/AcR88.png)
  
  > **Comments:**
  > **username_2**: Very nice Guy! Slick. I used Activity details is an exact match to condition just in case a reply back contains stop and start and they aren't intending to opt in or out. It is case insensitive.  
  > **username_1**: Thanks Andy. I am surprised the Twilio extension doesn’t have this capability built in.  
  > **username_1**: The Twilio extension does have this capability built-in now.  
  
  ---
  
  ### Answer by username_3 on 2020-10-27. Score: 2
  
  It's probably possible to do via an extension, e.g. something similar to <https://civicrm.org/extensions/auto-reply-twilio-sms>
  
  Otherwise there is a generic "inbound" function that handles incoming sms if the provider lets you set up a callback, e.g. [twilio setup](https://docs.civicrm.org/user/en/latest/sms-text-messaging/set-up/#setting-up-your-new-mobile-phone-number-in-twilio), and it's implemented in civi via [this code](https://github.com/civicrm/civicrm-core/blob/60080668785d1e389bd81260bb13210b428f224f/CRM/SMS/Provider.php#L193) and individual sms provider extensions can use it [like this](https://github.com/civicrm/org.civicrm.sms.twilio/blob/c324f44365c5fc886d2564891555cd46a00c739f/org_civicrm_sms_twilio.php#L189).
  
  So it seems possible to implement something generic.
  
  
  ---
  
  