Apex API Reference
  • 03 Nov 2022
  • 3 Minutes to read
  • Dark
    Light
  • PDF

Apex API Reference

  • Dark
    Light
  • PDF

Article Summary

Under the Hood

The ScreenMeet Apex API is a wrapper around a REST interface that makes callouts to the ScreenMeet REST API. The Apex wrapper takes care of things like authentication and message serialization for you automatically.

If you use the ScreenMeet API with any kind of synchronous code, such as Triggers or Flow Processes, you will need to add the @future(Callout=true) annotation to any helper functions which call methods from the ScreenMeet API. Read more about @future annotations here.

screenmeet.ScreenMeetAPI.ScreenMeetSessionParams

This object is used to define properties for a session which you are trying to either create or schedule.

Properties

PropertyTypeDescription
parentObjectMap<String, Object>This map will contain properties describing the parent object. The constructor generates this object automatically.
metaDataMap<String, Object>This object contains extra metadata about the session request and stores data such as the version of the interface being used. This property is also auto-populated by the constructor.
agentPrefsScreenMeetSessionAgentPrefsThis object contains the settings which the agent can toggle for this session.
labelStringThe label/description for this session.
typeString (enum)An enum that supports four values: support, cobrowse, live, and replay.
externalMappingStringThis field is created automatically during construction. It acts as a globally unique identifier in the ScreenMeet system to determine which sessions are associated with the parent object. It will generally be a concatenation of the Organization Id and parentObjectId.
startTimeString (ISO Date format)This field contains the desired start time of this call and is only used for scheduled sessions.
userDescriptionStringThe description of the user. Usually this will be the name of the agent who created the session. It will be shown to the end-user in support and co-browse sessions during the permission-consent process.

Constructor

PropertyTypeDescription
sessionType

String (enum)An enum that supports four values describing the type of session to create: support, cobrowse, live, and replay.
parentObjectIdStringThe Salesforce ID of the Object with which this session is to be associated.
parentObjectType

StringThe type of object with which this session is associated, e.g., case, opportunity, serviceappointment, and user.
labelStringThe label/description for this session.
userDescStringThe description of the user. Usually, this will be the name of the agent who created the session and will be shown to the end-user in support and co-browse sessions during the permission-consent process.

Example Usage

Java
screenmeet.ScreenMeetAPI.ScreenMeetSessionParams newSessionParams = new screenmeet.ScreenMeetAPI.ScreenMeetSessionParams( 'live', //session type '5001R00000xgLmIQAU', //parentObjectId 'case', //owner object type UserInfo.getUserId(), //Logged in user ID 'My Support Session', //session description UserInfo.getName() //name of currently logged in USER );

screenmeet.ScreenMeetAPI.ScreenMeetSessionAgentPrefs

This object contains the settings which the agent can toggle for this session.

PropertyTypeDescription
recordBooleanWhether or not the session should be recorded.
knockBooleanSupported only by Live sessions. Indicates the Host must approve the attendee before joining.
startwithrcBooleanSupported only by Remote Support sessions. Requests remote-control entitlement on start.
startwithadminBooleanSupported only by Remote Support sessions. Requests admin permissions to the device on start.

Example Usage

Java
screenmeet.ScreenMeetAPI.ScreenMeetSessionAgentPrefs prefs = new screenmeet.ScreenMeetAPI.ScreenMeetSessionAgentPrefs(); prefs.record = true; prefs.startwithadmin = true; prefs.startwithrc = true; //set the agentPrefs of our session params object newSessionParams.agentPrefs = prefs;

Methods

createSession

This method is used to create a new session.

Signature

Map<String, Object> screenmeet.ScreenMeetApi.createSession(ScreenMeetSessionParams newSession)

Example

Java
screenmeet.ScreenMeetApi.createSession(newSessionParams);

scheduleSession

This method is used to schedule a session that starts in the future.

Signature

Map<String, Object> screenmeet.ScreenMeetApi.scheduleSession(ScreenMeetSessionParams newSession, string ISODateTime)

Example

Java
screenmeet.ScreenMeetApi.scheduleSession(myNewSessionParams, '2021-05-20T23:30:00.000Z');


rescheduleRemoteSession

This method is used to change the starting time of a previously scheduled session. 

Signature

Map<String, Object> screenmeet.ScreenMeetApi.rescheduleRemoteSession(String SmSessionId, string ISODateTime)

Example

Java
screenmeet.ScreenMeetApi.rescheduleRemoteSession('gJ3Sjv6sXkrS', '2021-05-20T23:30:00.000Z');

closeRemoteSession

This method is used to close a session which is either scheduled, new, or active. If the session is active, all connected users will be dropped and the session will be closed. 

Signature

Map<String, Object> screenmeet.ScreenMeetApi.closeRemoteSession(String SmSessionId);

Example

Java
screenmeet.ScreenMeetApi.closeRemoteSession('gJ3Sjv6sXkrS');

Putting it Together

The example below will create a ScreenMeet Live session with recording and knock to join enabled from a Case object record. You can call this in a Flow for any event:

//create the newSessionParams
screenmeet.ScreenMeetAPI.ScreenMeetSessionParams newSessionParams = new screenmeet.ScreenMeetAPI.ScreenMeetSessionParams( 
	'live', //session type 
	'5001R00000xgLmIQAU', //parentObjectId 
	'case', //owner object type 
	UserInfo.getUserId(), //Logged in user ID 
	'My Support Session', //session description
	UserInfo.getName() //name of currently logged in USER 
); 

//configure agent user preferences (optional) 
screenmeet.ScreenMeetAPI.ScreenMeetSessionAgentPrefs prefs = new screenmeet.ScreenMeetAPI.ScreenMeetSessionAgentPrefs();
prefs.record = true;
prefs.knock = true; 
//set the agentPrefs of our session params object
newSessionParams.agentPrefs = prefs;
//make the REST API call to create the session
screenmeet.ScreenMeetApi.createSession(newSessionParams);

Was this article helpful?