---
schema_version: "1"
id: e6e65ed6bed050e0440cb81d08583e7487f524e93c723b42a7b96e98dc72312d
title: Chatter Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_ConnectAPI_Chatter_static_methods.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Chatter_static_methods.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 71d36e22b365f7e3dedd9c138ddce4bc70497dc0624a468faee1d20cdc590055
description: Access information about followers and subscriptions for records.These methods are for Chatter. All methods are static.Delete a subscription. Use this method to stop following a record, a user, or a file.Get the first page of followers for a record.Get a page of followers for a record. Get information about a subscription.Submit a daily or weekly Chatter email digest job.
---
# Chatter Class

Access information about followers and subscriptions for records.

## Namespace

[ConnectApi](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_connect_api.htm "The ConnectApi namespace (also called Connect in Apex) provides classes for accessing the same data available in Connect REST API. Use Connect in Apex to create custom experiences in Salesforce.")

## Chatter Methods

These methods are for Chatter. All methods are static.

All methods in this class require Chatter and are subject to the per user, per namespace, per hour rate limit.

- **[deleteSubscription(communityId, subscriptionId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Chatter_static_methods.htm#apex_ConnectAPI_Chatter_deleteSubscription)**  
    Delete a subscription. Use this method to stop following a record, a user, or a file.
- **[getFollowers(communityId, recordId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Chatter_static_methods.htm#apex_ConnectAPI_Chatter_getFollowers)**  
    Get the first page of followers for a record.
- **[getFollowers(communityId, recordId, pageParam, pageSize)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Chatter_static_methods.htm#apex_ConnectAPI_Chatter_getFollowers_2)**  
    Get a page of followers for a record.
- **[getSubscription(communityId, subscriptionId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Chatter_static_methods.htm#apex_ConnectAPI_Chatter_getSubscription)**  
    Get information about a subscription.
- **[submitDigestJob(period)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_Chatter_static_methods.htm#apex_ConnectAPI_Chatter_submitDigestJob_1)**  
    Submit a daily or weekly Chatter email digest job.

### deleteSubscription(communityId, subscriptionId)

Delete a subscription. Use this method to stop following a record, a user, or a file.

#### API Version

28.0

#### Requires Chatter

Yes

#### Signature

public static void deleteSubscription(String communityId, String subscriptionId)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

subscriptionId

Type: String

The ID for a subscription.

#### Return Value

Type: Void

#### Usage

“Following” a user, group, or record is the same as “subscribing” to a user, group, or record. A “follower” is the user who followed the user, group, or record. A “subscription” is an object describing the relationship between the follower and the user, group, or record they followed.

To leave a group, call [deleteMember(communityId, membershipId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterGroups_static_methods.htm#apex_ConnectAPI_ChatterGroups_deleteMember "Remove a member from a group.").

#### Example

When you follow a user, the call to ConnectApi.ChatterUsers.follow returns a ConnectApi.Subscription object. To stop following the user, pass the id property of that object to this method.

ConnectApi.Chatter.deleteSubscription(null, '0E8RR0000004CnK0AU');

#### See Also

- [_Apex Developer Guide_: Follow a Record](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_examples_follow_record.htm "Apex Developer Guide: Follow a Record - HTML (New Window)")
- [follow(communityId, userId, subjectId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterUsers_static_methods.htm#apex_ConnectAPI_ChatterUsers_follow "Follow a user or record.")

### getFollowers(communityId, recordId)

Get the first page of followers for a record.

#### API Version

28.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.FollowerPage getFollowers(String communityId, String recordId)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

recordId

Type: String

ID for a record or the keyword me.

#### Return Value

Type: [ConnectApi.​FollowerPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_Follower_Page.htm "Page of followers.")

#### Usage

“Following” a user, group, or record is the same as “subscribing” to a user, group, or record. A “follower” is the user who followed the user, group, or record. A “subscription” is an object describing the relationship between the follower and the user, group, or record they followed.

#### See Also

- [Follow a Record](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_examples_follow_record.htm "Follow a Record - HTML (New Window)")

### getFollowers(communityId, recordId, pageParam, pageSize)

Get a page of followers for a record.

#### API Version

28.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.FollowerPage getFollowers(String communityId, String recordId, Integer pageParam, Integer pageSize)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

recordId

Type: String

ID for a record or the keyword me.

pageParam

Type: Integer

Number of the page you want returned. Starts at 0. If you pass in null or 0, the first page is returned.

pageSize

Type: Integer

Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.

#### Return Value

Type: [ConnectApi.​FollowerPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_Follower_Page.htm "Page of followers.")

#### Usage

“Following” a user, group, or record is the same as “subscribing” to a user, group, or record. A “follower” is the user who followed the user, group, or record. A “subscription” is an object describing the relationship between the follower and the user, group, or record they followed.

#### See Also

- [https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi\_examples\_follow\_record.htm](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_examples_follow_record.htm "https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi_examples_follow_record.htm - HTML (New Window)")

### getSubscription(communityId, subscriptionId)

Get information about a subscription.

#### API Version

28.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.Subscription getSubscription(String communityId, String subscriptionId)

#### Parameters

communityId

Type: String

ID for an Experience Cloud site, internal, or null.

subscriptionId

Type: String

The ID for a subscription.

#### Return Value

Type: [ConnectApi.​Subscription](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_subscription.htm "Subscription.")

#### Usage

“Following” a user, group, or record is the same as “subscribing” to a user, group, or record. A “follower” is the user who followed the user, group, or record. A “subscription” is an object describing the relationship between the follower and the user, group, or record they followed.

#### See Also

- [Follow a Record](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_examples_follow_record.htm "Follow a Record - HTML (New Window)")

### submitDigestJob(period)

Submit a daily or weekly Chatter email digest job.

#### API Version

37.0

#### Requires Chatter

Yes

#### Signature

public static ConnectApi.DigestJobRepresentation submitDigestJob(ConnectApi.DigestPeriod period)

#### Parameters

**period**

Type: [ConnectApi.DigestPeriod](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/connectAPI_enums.htm#DigestFrequencyEnum)

Time period that’s included in a Chatter email digest. Values are:

- DailyDigest—The email includes up to the 50 latest posts from the previous day.
- WeeklyDigest—The email includes up to the 50 latest posts from the previous week.

#### Return Value

Type: [ConnectApi.DigestJob](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_digest_job.htm#apex_connectapi_output_digest_job "Represents a successfully enqueued API digest job request.")

#### Usage

The times when Chatter sends email digests are not configurable in the UI. To control when email digests are sent and to use this method, contact Salesforce to enable API-only Chatter Digests.

![Warning](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/images/icon_note_warning.png)

#### Warning

Enabling API-only Chatter Digests disables the scheduled digests for your org. You must call the API for your users to receive their digests.

We recommend scheduling digest jobs by implementing the Apex Schedulable interface with this method. To monitor your digest jobs from Setup, enter Background Jobs in the Quick Find box, then select **Background Jobs**.

#### Example

Schedule daily digests:

global class ExampleDigestJob1 implements Schedulable {
   global void execute(SchedulableContext context) {
      ConnectApi.Chatter.submitDigestJob(ConnectApi.DigestPeriod.DailyDigest);
   }
}

Schedule weekly digests:

global class ExampleDigestJob2 implements Schedulable {
   global void execute(SchedulableContext context) {
      ConnectApi.Chatter.submitDigestJob(ConnectApi.DigestPeriod.WeeklyDigest);
   }
}

#### See Also

- [Apex Scheduler](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_scheduler.htm "Apex Scheduler - HTML (New Window)")