# Managing Apteco SMS opt-outs

When setting up your Apteco SMS channel, you can send messages in two ways:

- **Using a specified phone number**: messages appear to originate from this number
- **Using an alphanumeric sender ID** (e.g. your company name): messages display this as the sender

See [Apteco SMS](<https://help.apteco.com/en/orbit/campaigns/apteco-sms/index.md>).

The process for managing opt-outs differs between the two.

## Standard long number opt-outs

When sending SMS via long numbers (two-directional), you can process recipient responses through either FERG or the AptecoResponsesAPI webhook. See [Setting up Apteco SMS webhooks for responses](<https://help.apteco.com/en/admin/configuration/webhooks/apteco-sms-webhooks/index.md>).

Long numbers support direct response handling, making opt-out management straightforward.

## Setting opt-out keywords

Configure opt-out keywords in your channel settings:

JSON

```json
"OptOutKeywords": "OPTOUT,STOP,UNSUBSCRIBE"
```

When recipients reply with any of these keywords, the system records an entry in the Responses table with a `MessageType` of `OptOut`. This prevents further SMS messages to those numbers.

## Alphanumeric sender opt-outs

Alphanumeric senders (e.g. "Apteco") are one-directional and can't receive replies, which presents a challenge for opt-out management.

> [!NOTE]
>
> This solution requires Apteco software version Q2 2025 or later.

## Implementation steps

1. Configure your channel with:

   - **Sender**: Your alphanumeric name (e.g. "Apteco")
   - **Reply Sender**: Your dedicated opt-out long number

### Customer communication

Tell recipients that to opt out, they must text keywords like `STOP` to your designated opt-out number (the **Reply Sender** value).

### Technical details

When running a campaign with this configuration, the Broadcasts table records the parameters:

Text Only

```text
TargetSMS=true;MobileNumberField=Mobile;Sender=Apteco;UrnFieldName=Urn;Reply Sender=;
```

If recipients send opt-out keywords to the Reply Sender number, the SMS webhook records this in the **Responses** table with:

- Phone number in the Email field
- `MessageType` of `OptOut`

> [!NOTE]
>
> These entries won't have a Communication Key or BroadcastId, since nothing links them to specific originating messages.

### Suppression mechanism

The broadcast process suppresses delivery to any phone numbers that:

- Appear in the Email field of the Response table
- Have a `MessageType` of `OptOut`

### Identifying opt-outs for alphanumeric senders

Query the Response and ResponseDetails tables to identify opt-outs:

SQL

```sql
SELECT R.Email
FROM ResponseDetails RD
INNER JOIN Response R ON RD.Id = R.Id
WHERE RD.[Name] = 'To'
AND RD.[Value] = '447418628101'
AND R.MessageType = 'OptOut'
```

Replace `447418628101` with your specific opt-out number.
