CRM is used to manage custom collections of data.
The ServisBOT CLI supports a number of operations regarding CRM collections. These are:
sb-cli crm create
- Creates a new CRM collection from JSON or an inline file.sb-cli crm list
- Lists the existing CRM collections in the organization.sb-cli crm delete
- Deletes a CRM collection by its name.A collection can be created with the following JSON:
{
"name": "student",
"itemIdentifierField": "studentId",
"description": "A collection of students in the system"
}
For more info on these commands, run sb-cli crm --help
or sb-cli crm <command> --help
while logged into your organization.
Uploading a collection is done though SFTP.
Contact ServisBOT to set up SFTP for your organization. You will be asked to provide:
Once you have SFTP for your organization you can upload data to a collection. To do this, you will need to:
Ensure that the CSV contains a column with the name of the ItemIdentifierField for the collection. This is used to reference the item in the collection.
studentId,history,math,science
1,A,A,A
2,B,C,A
3,F,F,F
4,D,D,D
5,C,C,A
Login, the domain name is dependent on your organizations region. Currently only US is supported.
sftp sftpUser@courier.us1.servisbot.com
# Enter password when prompted
Upload a file, the file should be uploaded into a directory with the same name as the collections. In this case, the collection is called student
, so the file should be uploaded to student/<fileName>.csv
.
put student.csv student/student.csv
After this is done the data will be available in flow.
The collection data will be replaced with the data from the CSV file.
CRM can be used in flows with the CRM node - by supplying a CRM collection name and an item ID, the item is retrieved and stored in msg.crm.yourNodeName
.
The collection name can either be picked from a list of existing collections, or retrieved from the msg
object.
The collection item ID can be hardcoded as a string, or pulled from the msg
object.
In our example the CRM node is used to retrieve a student from the student
collection, if found, the data can be retrieved from msg.crm.student
. This will return an object containing the data uploaded in the CSV.
Sample markup for an interaction node:
<TimelineMessage>
<TextMsg>
Student ${crm.student.studentId} Grades:
History: ${crm.student.history}
Math: ${crm.student.math}
Science: ${crm.student.science}
</TextMsg>
</TimelineMessage>