+ Start a Discussion
Rafael Alejandro Gatica Patricio 13Rafael Alejandro Gatica Patricio 13 

Salesforce Feed Case create a Twiter o facebook post

Hello everyone,

I hope you can help me, I need to automatically sent a Direct Message or Post (through Twitter or Facebook) when a case is closed.

I have active the social objects (Social Persona and Social Post) and a Social Studio account.

In Social Studio the users can create a case in Salesforce (also create a Social Post and Social Persona). Through the chatter feeds (and a Quick Action) It is possible to answer whit post in Twetter or Fasebook (or a Direct Messag), but I can't find a way to automatically answer this (for example sent the privacity politics link or somthing).

Thanks and Regards

Ben EdwardsBen Edwards

Old post but adding here for completeness sake. This is possible via Apex. You need to first instantiate a SocialPost record, and then execute the SocialPublisher QuickAction (as simply creating the SocialPost record doesn't physically push the message to your social network).

Example code here:

// First, instantiate the new SocialPost record
SocialPost newPost = new SocialPost();
newPost.ParentId = '5000l000001rUDU'; // Id of the parent record, in this instance my Case Id
newPost.OutboundSocialAccountId = '0AL0l0000004CARGA2'; // Id of the SocialAccount record
newPost.ReplyToId = '0ST0l0000008QmL'; // Id of the original SocialPost message that this is replying to
newPost.MessageType = 'Private'; // In my instance I'm doing a Private Message, so setting this here
newPost.Content = 'Hey Ben!'; // The actual message to send

// Now instantiate the "QuickAction" that we want to execute. In this instance, I'm using
// the standard SocialPublisher action on the Case object.
QuickAction.QuickActionRequest req = new QuickAction.QuickActionRequest();
req.quickActionName = Schema.Case.QuickAction.SocialPublisher;
req.record = newPost; // Assign the post instatiated above to the QuickAction
req.contextId = '5000l000001rUDU'; // Set the Case ID to set context for the QuickAction

// Now execute the action, yay!
QuickAction.QuickActionResult res = QuickAction.performQuickAction(req);
Julhan MuhajiranJulhan Muhajiran
Hi Ben, I have a similar requirement,but in bulk instead. Can I call the Quick Action from a Macro to do initiate a bulk macro to send a private message to Facebook/Twitter accounts? Please advise. Thanks.