---
title: "Invocable Method"
slug: "invocable-method"
updated: 2025-06-04T11:51:05Z
published: 2025-06-04T11:51:05Z
canonical: "knowledge.lightico.com/invocable-method"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://knowledge.lightico.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Invocable Method

Lightico for Salesforce supports the following invocable actions:

- [Create a new session](/v1/docs/invocable-method#create-a-new-session)
- [Add a Workflow to a session](/v1/docs/invocable-method#add-a-workflow-to-a-session)
- [Add a PDF Template to a session](/v1/docs/invocable-method#add-a-pdf-template-to-a-session)
- [Add an ad hoc eSign to a session](/v1/docs/invocable-method#add-an-ad-hoc-esign-to-a-session)
- [Add a text message to a session](/v1/docs/invocable-method#add-a-text-message-to-a-session)
- [Generate a document from a Lightico template](/v1/docs/invocable-method#generate-a-document-from-a-lightico-template)
- [Legacy actions](/v1/docs/invocable-method#legacy-actions)

Note:

All actions are Global class.

## Create a new session

Action Name: `CreateSingleSession`

Creates a new Lightico collaboration session.

### Input parameters

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p><strong>Input class name:</strong> <strong><code data-backticks="3">CreateSingleSessionWrapper</code></strong></p></editor360-custom-block>

| Parameter | Type | Description |
| --- | --- | --- |
| `recordId` | string | ID # of Salesforce contact record from which the session is originating |
| `userId` | string | Identifies the Salesforce agent associated with this session |
| `lookUpField` | string | Name of the field that links the session object with another object |
| `userName` | string | Lightico username of the agent associated with this session |
| `teamId` | integer | Identifies the team from which the session is running. This number appears in the Administration UI - log in to Lightico and go to **Settings** > **Teams**. |
| `customerName` | string | Name of customer that is used in the session |
| > [!NOTE] > Note > > You must include `customerPhoneNumber` and/or `customerEmail`. |
| `customerPhoneNumber` | string | Customer's phone number for sending the SMS session invitation |
| `customerEmail` | string | Customer's email address for sending the session invitation |
| `autoOpen` | Boolean | `true` = when the customer open the invitation, the session opens to the first action (eSign, workflow, etc.) |
| `attachmentEnabled` | Boolean | `true` = enable customer to send a file to the agent via the Lightico chat `false` = disable customer ability to send a file via the chat |
| `chatActive` | Boolean | `true` = customer chat enabled, `false` = customer chat disabled - customer cannot send text message to agent |
| `sendNow` | Boolean | `true` = send a session invitation to the client upon creation of the session, `false` = do not send invitation |
| `hubName` | string | Name of the Lightico document storage integration hub - the final document will be saved here |

> [!WARNING]
> Legacy parameters
> 
> The following parameter is still supported:
> 
> - `esignTemplateId`: string; Identifies a PDF Template document to add to the session. This ID # is found at the top left when the document template is opened in the PDF editor. **Note:**We recommend creating the session with the `CreateSingleSession` endpoint, then adding a PDF Template with the `AddEsignToSession` action.

### Response

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p>Response class name: <strong><code data-backticks="3">CreateSingleSessionResponse</code></strong></p></editor360-custom-block>

| Parameter | Type | Description |
| --- | --- | --- |
| `sessionId` | string | Identifies a Lightico session |
| `customerId` | string | Identifies a specific customer - generated by Lightico |
| `agentURL` | string | Opens the agent collaboration UI |
| `customerURL` | string | Opens the customer collaboration UI |

### Example request

```plaintext
lightico.Lightico_GlobalMethods ins = new lightico.Lightico_GlobalMethods(); //new instance

lightico.Lightico_GlobalMethods.CreateSingleSessionResponse res = new lightico.Lightico_GlobalMethods.CreateSingleSessionResponse(); // new response class instance

lightico.Lightico_GlobalMethods.CreateSessionWrapper info = new lightico.Lightico_GlobalMethods.CreateSessionWrapper(); // action wrapper

info.lookUpField = 'lightico__contact__c';
info.recordId = '0030b00002PFJdoAAH';
info.customerEmail = 'jstarlin@email.com';
info.teamId = 1842;
info.customerName = 'Jim Starlin';
info.attachmentEnabled = true;
info.autoOpen = true;
info.sendNow = true;
info.emailSubject = 'You're invited to a Salesforce Collaboration Session';

res = ins.CreateSingleSession(info);

system.debug('Response ' + res);
```

## Add a Workflow to a session

Action Name: `AddWorkflow`

Adds a Workflow to a collaboration session.

> [!TIP]
> This action supports preconfigured Workflows with any of the following elements:
> 
> - PDF Template
> - Dynamic Document
> - Tick-Box Document

### Input parameters

**Input class name:**`AddWorkflowWrapper`

| Parameter | Type | Description |
| --- | --- | --- |
| `name` | string | Name of the Workflow. - This name shows up in the customer UI. - Replaces the name in the Workflow editor, for this session only. |
| `workflowTemplateId` | string | Identifies the preconfigured workflow. The ID can be copied from the Workflows page in Lightico Admin center. |
| `documents` |  | Container for the lists of documents that are in this Workflow and their properties. Use a separate list for each type of document (PDF Template, Dynamic Document, Tick-box Document). See the following parameters. |
| `documents.esignDocuments` |  | **PDF Templates** in this Workflow and properties to define in each one. |
| `esignDocuments.es.name` | string | Name of the PDF Template. This name overrides the name in the Workflow template and appears for the customer in the collaboration session. |
| `esignDocuments.es.templateId` | string | Identifies this PDF Template. This ID # is found in the settings tab of the PDF Template builder. |
| `documents.dynamicDocuments` | string | **Dynamic Documents**in this Workflow and properties to define in each one. |
| `dynamicDocuments.dd.name` | string | Name of the Dynamic Document. This name overrides the name in the Workflow template and appears for the customer in the collaboration session. |
| `dynamicDocuments.dd.templateId` | string | Identifies this Dynamic Document. This ID # is found in the **HTML**page of the Admin Center. |
| `dynamicDocuments.dd.url` | string | If there is a URL placeholder defined in this Dynamic Document, provide a URL address. For more information about embedded URLs in HTML documents, see [Add dynamic elements to a Dynamic Document](https://knowledge.lightico.com/docs/add-dynamic-elements-to-a-dynamic-document#embed-external-html-as-a-section). |
| `documents.tickboxDocuments` | string | **Tick-box Documents**in this Workflow and properties to define in each one. |
| `tickboxDocuments.dd.name` | string | Name of the Tick-box Document. This name overrides the name in the Workflow template and appears for the customer in the collaboration session. |
| `tickboxDocuments.dd.templateId` | string | Identifies this Tick-box Document. This ID # is found in the **HTML page** of the Admin Center. |
| `tickboxDocuments.dd.url` | string | If there is a URL placeholder defined in this Tick-box Document, provide a URL address. For more information about embedded URLs in HTML documents, see [Add dynamic elements to a Dynamic Document](https://knowledge.lightico.com/docs/add-dynamic-elements-to-a-dynamic-document#embed-external-html-as-a-section). |
| `participants` |  | Container for the list of participants in this Workflow. |
| `participants.p.label` | string | Label of this participant as it appears in the Workflow template. For an explanation of labels, see [Create multi-signer Workflows](/v1/docs/manage-multi-signer-in-workflows). |
| `participants.p.name` | string | Name of the actual participant to whom you are assigning to this label for this collaboration session. |
| > [!NOTE] > Note > > You must include an email or phone number for each participant. |
| `participants.p.email` | string | The participant’s email address. |
| `participants.p.phoneNumber` | string | The participant’s phone number. |

### Response

| Parameter | Type | Description |
| --- | --- | --- |
| `workflowTemplateId` | string | ID of the Lightico workflow template being used. |
| `name` | string | Name of the Workflow |
| `participants` | string | A list of people included in the session |
| `name` | string | see request above |
| `label` | string | see request above |
| `email` | string | see request above |
| `sessionAccessCode` | string | Code provided by this participant to enter the session |
| `documents` | string | Documents included in this Workflow See descriptions of the parameters in the response above |
| `workflowId` | string | The unique ID for the newly created Workflow, used to reference or track it later |

### Example request

```plaintext
// create add Workflow object
lightico.AddWorkflowWrapper request = new lightico.AddWorkflowWrapper();
request.name = 'Test Workflow';
request.workflowTemplateId = '7a7e5754-xxxx-43f0-990d-910b47959a7b';
request.documents = new lightico.Documents();

// add PDF Template
request.documents.esignDocuments = new List<lightico.EsignDocument>();
lightico.EsignDocument es = new lightico.EsignDocument();
es.name = 'Sales Contract';
es.templateId = '82a661c6-caeb-xxxx-8d1d-fd6a0eaed4c7';
request.documents.esignDocuments.Add(es);

// add participants
request.participants = new List<lightico.Participant>();
lightico.Participant p = new lightico.Participant();
p.label = 'Co-signer';
p.name = 'Walt Kelly';
p.email = 'waltk@email.com';
request.participants.Add(p);

// add Dynamic Document
request.documents.dynamicDocuments = new List<lightico.DynamicDocument>();
lightico.DynamicDocument dd = new lightico.DynamicDocument();
dd.name = 'Sales Contract 2';
dd.templateId = '4256028b-xxxx-4a34-b202-1aa35d4716b2';  //dynamic document id
dd.url = 'https://[static_url]';
request.documents.dynamicDocuments.Add(dd);

// add Tick-box Document
request.documents.tickboxDocuments = new List<lightico.TickboxDocument>();
lightico.TickboxDocument tb = new lightico.TickboxDocument();
tb.name = 'Sales Disclaimer';
tb.templateId = 'f10af005-xxxx-4582-949f-8bb8ad5ad5be';  //tickbox document id
tb.url = 'https://[static_url]';
tb.confirmationMessageText = 'confirm text';
tb.forceScrollDown = true;
request.documents.tickboxDocuments.Add(tb);

lightico.WorkflowInvoker lw = new lightico.WorkflowInvoker();
String workflowId = lw.AddWorkflowToSession(request,res.sessionId);
```

## Add a PDF Template to a session

Action name: `AddEsignToSession`

Add a PDF Template to an existing session.

### Input parameters

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p><strong>Input class name:</strong> <strong><code data-backticks="3">AddEsignToSessionWrapper</code></strong></p></editor360-custom-block>

| Parameter | Type | Description |
| --- | --- | --- |
| `sessionId` | string | Identifies an existing session |
| `esignTemplateId` | string | Identifies the document template. This ID # is found at the top left when the document template is opened in the PDF editor. |

### Response

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p>Response class name: <strong><code data-backticks="3">AddEsignToSessionResponse</code></strong></p></editor360-custom-block>

| Parameter | Type | Description |
| --- | --- | --- |
| `esignId` | string | Identifies a specific eSign document within a session |
| `statusCode` | integer | Response code, e.g. 200, 400 |
| `responseBody` | string | Response message, e.g. OK, Error |

## Add an External Document to a session

Action name: `AddEsign`

- Add an External Document to an existing session.
- The parameters in this action use tags to position signature, initials and signature date fields in the final PDF.

### Input parameters

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p><strong>Input class name:</strong> <strong><code data-backticks="3">AddEsignWrapper</code></strong></p></editor360-custom-block>

| Parameter | Type | Description |
| --- | --- | --- |
| `documentId` | string | Identifies a Salesforce document that you are adding to the session |
| `sessionId` | string | Identifies an existing session |
| `signatureTag` | string | Identifies the signature field position |
| `initialsTag` | string | Identifies the initials field position |
| `signatureDateTag` | string | Identifies the signature date field position |
| `fileName` | string | Name that you give to the eSign for this session. This is the name that will appear in the customer UI instead of the file name of the eSign. |
| `role` | string | Defines the role of the customer: `signer` = provides a signature, `approver` = approves by clicking a button |

### Response

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p>Response class name: <strong><code data-backticks="3">AddEsignResponse</code></strong></p></editor360-custom-block>

| Parameter | Type | Description |
| --- | --- | --- |
| `esignId` | string | Identifies a specific eSign document within a session |

## Add a text message to a session

Action name: `AddTextMessage`

Send a text message to the customer UI in a session. The text appears in the chat field of the collaboration UI.

### Input parameters

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p><strong>Input class name:</strong> <strong><code data-backticks="3">AddTextMessageWrapper</code></strong></p></editor360-custom-block>

| Parameter | Type | Description |
| --- | --- | --- |
| `sessionId` | string | Identifies the session to which you are adding this action |
| `textMessage` | string | Text of the message you are sending. Example: `Do you need help reviewing the document?` |

### Response

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p>Response class name: <strong><code data-backticks="3">AddTextMessageResponse</code></strong><br> Type: Boolean<br> Description: <code data-backticks="3">true</code>= message sent, <code data-backticks="3">false</code>= message was not sent</p></editor360-custom-block>

## Generate a document from a Lightico template

Action Name: `GenerateDocumentByTemplate`

Generates a PDF document based on a Lightico template and attributes mapped to Salesforce.

### Input parameters

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p><strong>Input class name:</strong> <strong><code data-backticks="2">DocumentGenerationData</code></strong></p></editor360-custom-block>

| Parameter | Type | Description |
| --- | --- | --- |
| recordId | string | ID # of Salesforce record from which to draw the attributes. In addition, the generated PDF is saved in the Notes and Attachments section of the record. |
| templateId | string | Identifies the document template. This ID # is found at the top left when the document template is opened in the PDF editor. |
| hubName | string, optonal | Custom hub name for filtering events |

### Response

Type: Boolean Description: `true`= success, `false`= failure

### Code example

```plaintext
Lightico_GlobalMethods lg = new Lightico_GlobalMethods();
Lightico_GlobalMethods.DocumentGenerationData data = new Lightico_GlobalMethods.DocumentGenerationData();
data.recordId = '0030b00002RounDAAR';
data.templateId = 'c8552241-f718-4ad7-8c58-e0b8323c35c3';
boolean res = lg.GenerateDocuemntByTemplate(data);
system.debug(res);
```

---

## Legacy actions

### Create a new session with an ad hoc eSign

**Action name:**`CreateSessionWithEsign`

- Creates a new session that can include an ad hoc eSign document.
- The parameters in this action use tags to postition signature, initials and signature date fields in the final PDF.

**Input parameters**

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p><strong>Input class name:</strong> <strong><code data-backticks="3">CreateSessionWithEsignWrapper</code></strong></p></editor360-custom-block>

| Parameter | Type | Description |
| --- | --- | --- |
| `userName` | string | Lightico username of the agent associated with this session |
| `lookUpField` | string | Name of the field that links the session object with another object |
| `signatureTag` | string | Identifies the signature field position |
| `initialsTag` | string | Identifies the initials field position |
| `signatureDateTag` | string | Identifies the signature date field position |
| `fileName` | string | Name that you give to the eSign for this session. This is the name that will appear in the customer UI instead of the file name of the eSign. |
| `role` | string | Defines the role of the customer: `signer` = provides a signature, `approver` = approves by clicking a button |
| `recordId` | string | Identifies the record from which the session will originate. |
| `chatActive` | Boolean | `true` = customer chat enabled, `false` = customer chat disabled - customer cannot send text message to agent |
| `customerName` | string | Name of customer that is used in the session |
| `sessionId` | string | Create an ID for this session instead of the default sessionId created by Lightico |
| `saveInAttachments` | Boolean | Save assets from this session in a generic object called "Attachments" instead of saving the assets in the Lightico files object |
|  | **Note:** | You must include `customerPhoneNumber` and/or `customerEmail`. |
| `customerPhoneNumber` | string | Customer's phone number for sending the SMS session invitation |
| `customerEmail` | string | Customer's email address for sending the session invitation |
| `sendNow` | Boolean | `true` = send a session invitation to the client upon creation of the session, `false` = do not send invitation |
| `documentId` | string | Identifies a Salesforce document that you are adding to the session |
| `hubName` | string, optonal | Name of the Lightico document storage integration hub - the final document will be saved here |

**Response**

<editor360-custom-block data-preprocessing="true" data-sanitizationtags="strong"><p>Response class name: <strong><code data-backticks="3">CreateSessionWithEsignResponse</code></strong></p></editor360-custom-block>

| Parameter | Type | Description |
| --- | --- | --- |
| `sessionId` | string | Identifies a Lightico session |
| `customerURL` | string | Opens the customer collaboration UI |
| `esignId` | string | Identifies a specific eSign document within a session |
| `runTime` | integer | Time in took for this action to be implemented in miliseconds |

A user that communicates with end-customers to complete tasks in a Collaboration Room session or a Case Manager case.

Each user is associated with a team. A team defines unique settings that affect how a Collaboration Room session functions and what cases are available in Case Manager.

A PDF document that has been enhanced with interactive fields so that it can be completed by a customer in a session.

A series of customer interactions that must be completed in a certain order. Workflows are configured by a business configurator (BC) and added to the session by an agent or API.

Documents created entirely in the Lightico UI, displayed as dynamic HTML and converted to PDF after signing or approval.

Used as part of a Workflow when you want customers to indicate that they have read some text by selecting a checkbox.

Area of the Lightico platform where you will find all settings, user management, and asset configuration pages. Access to this area is defined by a user's role and permissions.

A PDF document that is uploaded to a session from a source other than Lightico, for example, from the agent’s computer.
