March 31, 2021

How to create Messaging End User using Apex in Salesforce?

Sample Code:

MessagingEndUser objMsgUser = new MessagingEndUser();
objMsgUser.ContactId = '<ContactId>';
objMsgUser.MessagingChannelId = '<Messaging Channel Id>';
objMsgUser.MessagingConsentStatus = 'ImplicitlyOptedIn';
objMsgUser.MessageType = 'Text';//For SMS Channel
objMsgUser.MessagingPlatformKey = '<Platform Key>';//Go to Messaging Settings to view
objMsgUser.Name = '<Name>';
insert objMsgUser;

No comments:

Post a Comment