# SMS and Viber marketing consent

Pushwoosh stores marketing consent for SMS and Viber in two default tags. Before it sends a marketing SMS or Viber message, Pushwoosh checks the tag of each recipient. Phone numbers that opted out don't get the message. [Transactional messages](/product/messaging-channels/marketing-vs-transactional/) are sent without this check.

## Consent tags

| Tag | Channel | Values |
| ----- | ----- | ----- |
| **SMS Marketing Consent** | SMS | `true`: the phone number agreed to marketing SMS.<br/>`false`: the phone number opted out.<br/>No value: Pushwoosh doesn't know whether the phone number agreed. |
| **Viber Marketing Consent** | Viber | `true`: the phone number agreed to marketing Viber messages.<br/>`false`: the phone number opted out.<br/>No value: Pushwoosh doesn't know whether the phone number agreed. |

Both are Boolean tags. Each SMS or Viber subscriber has its own value in each application. One phone number registered for SMS and for Viber is two separate subscribers, so consent on one channel doesn't change the other.

Pushwoosh adds the tag to your account the first time a value is written: when a phone number first opts out, or when you first set the tag yourself. After that, the tag appears on the [Tags](/product/audience-data-and-segmentation/user-data-tags/tags/) page. Use it in [segment filters](/product/audience-data-and-segmentation/segmentation/) like any other Boolean tag, for example, to count subscribers who agreed to marketing.

## Which messages are blocked

Each application works in one of two modes, set separately for SMS and Viber:

* **Opt-out mode** (default): marketing messages go to every subscriber except those with the tag set to `false`.
* **Opt-in mode**: marketing messages go only to subscribers with the tag set to `true`.

| Tag value | Marketing message | Transactional message |
| ----- | ----- | ----- |
| `true` | Sent | Sent |
| `false` | Not sent | Sent |
| No value | Sent in opt-out mode<br/>Not sent in opt-in mode | Sent |

A message is transactional only when you choose **Transactional message** in the [SMS](/product/customer-journey/journey-elements/channels/sms/#set-message-type) or [Viber](/product/customer-journey/journey-elements/channels/viber/#set-message-type) element. Pushwoosh checks all other messages as marketing, including SMS sent without a message type.

Pushwoosh checks consent before it applies the [control group](/product/audience-data-and-segmentation/control-groups/). A subscriber who can't receive the message isn't added to the control group of that message.

## Switch to opt-in mode

<Aside type="caution">
In opt-in mode, subscribers without a tag value stop getting marketing messages. Record consent for every subscriber who agreed before you switch.
</Aside>

1. Set **SMS Marketing Consent** or **Viber Marketing Consent** to `true` for every subscriber who agreed to marketing messages. See [Record consent](#record-consent).
2. Contact [Pushwoosh Support](https://help.pushwoosh.com/hc/en-us/requests/new). Name the application and the channels to switch.

You can't change the mode in the Control Panel.

## Record consent

<Aside type="caution" icon="setting" title="Developer assistance needed">
You'll need help from your development team to record consent.
</Aside>

Ask your developers to set the tag with the [`setTags`](/developer/api-reference/device-api/#settags) API method when a person agrees to or declines marketing messages, for example, on a signup form. The request needs the code of the application you send from and the subscriber's `hwid`:

* SMS: the phone number in E.164 format, for example, `+15551234567`.
* Viber: the phone number in E.164 format with the `viber:` prefix, for example, `viber:+15551234567`.

The phone number must already be [registered](/product/first-steps/start-with-your-project/register-users/import-contacts/) as an SMS or Viber subscriber in that application.

Pushwoosh never sets the tag to `true` by itself. A reply such as `START` doesn't restore consent. Only your developers' `setTags` request does.

## Opt-outs Pushwoosh records automatically

Pushwoosh sets the tag to `false` when a person opts out in one of these ways:

* **Reply by SMS or Viber:** the reply is exactly `STOP`, `STOPALL`, `UNSUBSCRIBE`, `CANCEL`, `END`, or `QUIT`. Upper or lower case and a final `.` or `!` are accepted. A longer reply that contains the word, such as "please stop the delivery", isn't an opt-out. Pushwoosh gets replies from Twilio, MStat, and CapitoleMobile after their incoming webhook is [set up](/developer/first-steps/connect-messaging-services/sms-configuration/sms-provider-webhooks/).
* **Opt-out at the mobile operator:** the SMS provider rejects a message because the person unsubscribed with their mobile operator. Pushwoosh records Twilio error `21610` and SMSAPI.ro errors `57` and `59`.
* **Unsubscribe in Viber:** the person unsubscribes from your business account in Viber, and MStat reports it through the Viber subscription webhook.

After any of these opt-outs, Pushwoosh also unsubscribes the phone number from the channel. The phone number gets no messages on that channel, including transactional ones. If the phone number is registered again later, transactional messages resume. Marketing messages stay blocked until you set the tag to `true`.

## Blocked messages in statistics

Pushwoosh logs a subscriber skipped for missing consent with status code `1038` for SMS or `1039` for Viber. Message statistics count these subscribers as unsubscribed, not as delivery errors.