# Push Messaging

This section provides API reference details for the Push Messaging module in the React Native unified plugin.

## enablePush

Enables push messaging in the native Marketing Cloud SDK.

### Syntax

```javascript
PushMessagingSdkModule.enablePush();
```

### Returns

- `void`

### Example

```javascript
import { PushModule } from "@sfmc/react-native-push";
import type { PushApi } from "@sfmc/react-native-push";

const push: PushApi = await PushModule.requestSdk();
push.enablePush();
```

### See Also

- [Android SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/javadocs/SFMCSdk/11.0/pushfeaturemodule/com.salesforce.marketingcloud.pushfeature.push/-push-message-manager/enable-push.html)
- [iOS SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/appledocs/PushFeatureSdk/2.0/Classes/PushFeature.html#/c:@CM@PushFeatureSDK@objc\(cs\)SFPushFeature\(im\)setPushEnabledWithPushEnabled:)

## disablePush

Disables push messaging in the native Marketing Cloud SDK.

### Syntax

```javascript
PushMessagingSdkModule.disablePush();
```

### Returns

- `void`

### Example

```javascript
import { PushModule } from "@sfmc/react-native-push";
import type { PushApi } from "@sfmc/react-native-push";

const push: PushApi = await PushModule.requestSdk();
push.disablePush();
```

### See Also

- [Android SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/javadocs/SFMCSdk/11.0/pushfeaturemodule/com.salesforce.marketingcloud.pushfeature.push/-push-message-manager/disable-push.html)
- [iOS SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/appledocs/PushFeatureSdk/2.0/Classes/PushFeature.html#/c:@CM@PushFeatureSDK@objc\(cs\)SFPushFeature\(im\)setPushEnabledWithPushEnabled:)

## isPushEnabled

Returns the current state of the push-enabled flag in the native Marketing Cloud SDK.

### Syntax

```javascript
PushMessagingSdkModule.isPushEnabled();
```

### Returns

- `Promise<boolean>` - A promise that resolves to whether push messaging is enabled.

### Example

```javascript
import { PushModule } from "@sfmc/react-native-push";
import type { PushApi } from "@sfmc/react-native-push";

const push: PushApi = await PushModule.requestSdk();
const enabled = await push.isPushEnabled();
```

### See Also

- [Android SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/javadocs/SFMCSdk/11.0/pushfeaturemodule/com.salesforce.marketingcloud.pushfeature.push/-push-message-manager/is-push-enabled.html)
- [iOS SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/appledocs/PushFeatureSdk/2.0/Classes/PushFeature.html#/c:@CM@PushFeatureSDK@objc\(cs\)SFPushFeature\(im\)isPushEnabled)

## getPushToken

Returns the token that Marketing Cloud uses to send push messages to the device.

### Syntax

```javascript
PushMessagingSdkModule.getPushToken();
```

### Returns

- `Promise<string \| null>` - A promise that resolves to the push token string, or `null`.

### Example

```javascript
import { PushModule } from "@sfmc/react-native-push";
import type { PushApi } from "@sfmc/react-native-push";

const push: PushApi = await PushModule.requestSdk();
const token = await push.getPushToken();

const sub = PushModule.getEmitter().addListener("sfmc_push_token_refreshed", ({ token }) => {
  console.log("Token refreshed:", token);
});

sub.remove();
```

### See Also

- [Android SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/javadocs/SFMCSdk/11.0/pushfeaturemodule/com.salesforce.marketingcloud.pushfeature.push/-push-message-manager/get-push-token.html)
- [iOS SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/appledocs/PushFeatureSdk/2.0/Classes/PushFeature.html#/c:@CM@PushFeatureSDK@objc\(cs\)SFPushFeature\(im\)deviceToken)
