---
source_url: https://www.pubnub.com/docs/sdks/twisted/api-reference/mobile-push
title: Mobile Push Notifications API for Python-Twisted SDK
updated_at: 2026-05-19T12:13:43.676Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Mobile Push Notifications API for Python-Twisted SDK

:::note Deprecated
**NOTICE:** Based on current web trends and our own usage data, PubNub's Python Twisted SDK is **deprecated** as of May 1, 2019. Deprecation means we will no longer be updating the Python Twisted SDK but will continue to support users currently using it. Please feel free to use our other Python SDK offerings as they will continue to be supported and maintained. If you would like to use the Python Twisted SDK specifically, we would love to work with you on keeping this project alive!
:::

Mobile Push Notifications feature enables developers to bridge native PubNub publishing with 3rd-party push notification services including Google Android FCM (Firebase Cloud Messaging) and Apple iOS APNs (Apple Push Notification service).

To learn more, read about [Mobile Push Notifications](https://www.pubnub.com/docs/general/push/send).

## Add a device to a push notifications channel

:::note Requires Mobile Push Notifications add-on
Enable Mobile Push Notifications for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

Enable mobile push notifications on a set of channels.

### Method(s)

Use the following method(s) in the Python-Twisted SDK:

```python
pubnub.add_channels_to_push().push_type(PNPushType).channels(List).device_id(String).topic(String).environment(PNPushEnvironment)
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| push_type | PNPushType | Yes |  | Accepted values: `PNPushType.GCM`, `PNPushType.FCM`, `PNPushType.APNS`, `PNPushType.APNS2`. |
| channels | List | Yes |  | Channels to enable for push notifications. |
| device_id | String | Yes |  | Device token. |
| topic | String | Optional |  | APNs topic (bundle identifier). Required if `push_type` is `PNPushType.APNS2`. |
| environment | String | Optional | `PNPushEnvironment.DEVELOPMENT` | APNs environment. Required if `push_type` is `PNPushType.APNS2`. |

### Sample code

#### Add device to channel

```python
from pubnub.enums import PNPushType

d = pubnub.add_channels_to_push()\
    .push_type(PNPushType.GCM)\
    .channels(["ch1", "ch2", "ch3"])\
    .device_id("deviceId")\
    .deferred()
d.addCallback(my_callback)
```

### Returns

The `add_channels_to_push()` does not return actionable data. Check `status.is_error()` on the status object.

## List push notifications channels for a device

:::note Requires Mobile Push Notifications add-on
Enable Mobile Push Notifications for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

List channels that have push notifications enabled for the specified device token.

### Method(s)

Use the following method(s) in the Python-Twisted SDK:

```python
pubnub.list_push_channels().push_type(PNPushType).device_id(String).topic(String).environment(PNPushEnvironment)
```

| Parameter | Description |
| --- | --- |
| `push_type` *Type: PNPushTypeDefault: n/a | Accepted values: `PNPushType.GCM`, `PNPushType.FCM`, `PNPushType.APNS`, `PNPushType.APNS2`. |
| `device_id` *Type: StringDefault: n/a | Device token. |
| `topic`Type: StringDefault: n/a | APNs topic (bundle identifier). Required if `push_type` is `PNPushType.APNS2`. |
| `environment`Type: StringDefault: `PNPushEnvironment.DEVELOPMENT` | APNs environment. Required if `push_type` is `PNPushType.APNS2`. |

### Sample code

#### List channels for device

```python
from pubnub.enums import PNPushType

d = pubnub.list_push_channels()\
    .push_type(PNPushType.GCM)\
    .device_id("deviceId")\
    .deferred()
d.addCallback(my_callback)
```

### Returns

The `list_push_channels()` operation returns a `PNPushListProvisionsResult` which contains the following fields:

| Method | Description |
| --- | --- |
| `Channels`Type: List | List of `channels` associated for mobile push notifications. |

## Remove a device from push notifications channels

:::note Requires Mobile Push Notifications add-on
Enable Mobile Push Notifications for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

Disable mobile push notifications on a set of channels.

### Method(s)

Use the following method(s) in the Python-Twisted SDK:

```python
pubnub.remove_channels_from_push().push_type(PNPushType).channels(List).device_id(String).topic(String).environment(PNPushEnvironment)
```

| Parameter | Description |
| --- | --- |
| `push_type` *Type: PNPushTypeDefault: n/a | Accepted values: `PNPushType.GCM`, `PNPushType.FCM`, `PNPushType.APNS`, `PNPushType.APNS2`. |
| `channels` *Type: ListDefault: n/a | Channels to disable for push notifications. |
| `device_id` *Type: StringDefault: n/a | Device token. |
| `topic`Type: StringDefault: n/a | APNs topic (bundle identifier). Required if `push_type` is `PNPushType.APNS2`. |
| `environment`Type: StringDefault: `PNPushEnvironment.DEVELOPMENT` | APNs environment. Required if `push_type` is `PNPushType.APNS2`. |

### Sample code

#### Remove device from channel

```python
from pubnub.enums import PNPushType

d = pubnub.remove_channels_from_push()\
    .push_type(PNPushType.GCM)\
    .channels("ch1", "ch2", "ch3")\
    .device_id("deviceId")\
    .deferred()
d.addCallback(my_callback)
```

### Returns

The `remove_channels_from_push()` does not return actionable data. Check `status.is_error()` on the status object.