Exports

A site can have any number of export configurations, known as definitions. A definition is a set of attributes that describe how either engagements or offline messages are exported. When Glia generates an engagement or offline messsage, it is exported to all recipients included in the definition that have access to the site. Export definitions can be organized into folders.

Export Types

Exports have different types, depending on how they are triggered:

Type

Known as

Trigger

engagement_start

Engagement Start Export

Start of an engagement.

engagement_transfer

Engagement Transfer Export

Engagement transfer. The export will be triggered after a successful transfer.

engagement

Engagement End Export

Ending of an engagement.

inbox_message

Generic Message Export, Inbox Message Export

A message is left by a visitor and no specific operator has been identified for that message.

operator_message

Operator Message Export

A message is left by a visitor for a specific operator.

voicemail

Voicemail Export

A voicemail is left by a visitor calling an Incoming Phone Number.

Definitions

An export definition can have the following parameters:

Parameter

Type

Description

name

String

A descriptive title for the export.

type

String

The type of export, relates closely with the event that triggers the export. Accepted values are engagement_start, engagement_transfer, engagement, inbox_message, operator_message and voicemail; see more in Export Types.

content_type

String

This specifies the content-type of the export definition. Supported values are: text/html; charset=UTF-8, application/xml, and application/json.

email_recipient

Object

A JSON object describing how Leads are sent via email.

crm_recipient

Object

A JSON object describing how the Leads are sent via HTTP POST.

template

String

A template in XML, JSON, or HTML format that will be used as the template for the content of the export. The template must be in UTF-8 encoding.

enabled

Boolean

Specifies whether the export is active.

updated_by

String

Email of the operator who last updated the export template. This field is only returned in responses and cannot be sent in requests.

send_to_operator

Boolean

Specifies whether the export is sent to corresponding operator(s). For export type engagement, the export is sent to all operators who participated in the engagement. For export type inbox_message, the export is sent to all operators associated with the site.

trigger

String

Specifies whether the export template should be triggered automatically, or only when the operator explicitly opts in. Possible values are, respectively, system and on_demand

created_at

Date

The timestamp indicating when the export was created.

updated_at

Date

The timestamp indicating when the export was last updated.

folder_id

String

Uniquely identifies the folder to which the export belongs.

email_subject

String

The subject for exports sent by email. A subject can contain field tags to dynamically include export-specific data. (For more information, see Field Tags, below.

Note: Data returned using field tags in a JSON template are automatically enclosed in quotation marks when appropriate for their data type. For example: {visitor_name} yields "Sasha Brown".

The parameter email_recipient should include two attributes:

Attribute

Type

Description

enabled

Boolean

This specifies whether the export should be sent by email. Valid values are true and false.

emails

Array

An array of email addresses to which the export should be sent.

The parameter crm_recipient should include three attributes:

Attribute

Type

Description

enabled

Boolean

This specifies whether the export should be sent by HTTP POST. Valid values are true and false.

url

String

The URL to which the export should be sent.

headers

Headers

A set of headers to be sent along with the HTTP POST request. Typically, headers are used for authorization.

The template parameter may contain field tags, which are enclosed with braces {}, signaling them to be parsed and replaced with their values from the engagement or offline message when an export occurs. For example, where {visitor_name} appears in a template, a visitor's name will appear in each export defined by that template. Below is a table listing the field tags that can be included in the template, and describing the data that will dynamically replace them.

Field Tags

The following field tags can be used in templates for Engagement Start Exports:

Field

Type

Description

custom_fields

Collection

Visitor’s custom attributes. See custom_fields.

engagement_id

String

Engagement ID

operator_email

String

Operator email

operator_id

String

Operator ID

operator_name

String

Operator name

platform

String

The platform where the engagement was initiated. Possible values are omnicore and omnibrowse.

queue_wait_time

Integer

The time visitor spent in queue waiting for the engagement, in seconds.

queues

Collection

A list of queues that the visitor was enqueued in before starting the engagement. See queues

site_id

String

Site ID

source

String

Engagement source. One of Engagement sources.

visitor_email

String

Visitor email

visitor_id

String

Visitor ID

visitor_name

String

Visitor name

visitor_phone

String

Visitor phone

The following field tags can be used in templates for Engagement Transfer Exports:

Field

Type

Description

custom_fields

Collection

Visitor’s custom attributes. See custom_fields.

engagement_id

String

Engagement ID

operator_email

String

Receiving operator email

operator_id

String

Receiving operator ID

operator_name

String

Receiving operator name

site_id

String

ID of the site where the engagement was transferred to.

source

String

Engagement source. One of Engagement sources.

visitor_email

String

Visitor email

visitor_id

String

Visitor ID

visitor_name

String

Visitor name

visitor_phone

String

Visitor phone

The following field tags can be used in templates for Engagement End Exports:

Field

Type

Description

Formatting in HTML templates

audio_used

Boolean

Whether audio was used in the engagement.

Yes/No

chat_transcript_plain_text

String

Chat transcript of the engagement in plain text. For each message: *SENDER_NAME*: CONTENT concatenated in a single line. Note that there also exists a structured field, chat_transcript, which can be called via GET request. See Engagements.

chat_transcript

Collection

The collection of chat messages exchanged between the visitor and the operator, including system messages the operator received during the engagement. See chat_transcript.

cobrowsing_used

Boolean

Whether CoBrowsing was used in the engagement

Yes/No

crm_forwarded

Boolean

Whether the CRM export has already occurred.

Yes/No

custom_fields

Collection

A collection of the visitor’s custom attributes. See custom_fields.

engagement_duration

Integer

The engagement duration in seconds.

E.g. 1 second or 427 seconds

engagement_ended_at

Date

The engagement end timestamp.

Full date with 24-hour time (in UTC/GMT timezone), e.g. September 14th, 2016 15:00

engagement_flagged

Boolean

Whether the engagement has been flagged.

Yes/No

engagement_id

String

Unique identifier for the engagement.

engagement_started_at

Date

The engagement start timestamp.

Full date with 24-hour time (in UTC/GMT timezone), e.g. September 14th, 2016 15:00

engagement_type

String

The engagement type.

Either reactive or proactive

initiator

String

The initiator of the engagement.

Either visitor or operator

notes

String

Notes by operator(s) from the engagement.

operator_shared_screen

Boolean

Whether the operator shared their screen during the engagement.

Yes/No

operators

Collection

Operators who participated in the engagement and their unique identifiers. See operators.

platform

String

The platform where the engagement was initiated. Possible values are omnicore and omnibrowse.

queue_wait_time

Integer

The time visitor spent in queue waiting for the engagement, in seconds.

E.g. 1 second or 427 seconds

queues

Collection

A list of queues that the visitor was enqueued in before starting the engagement. See queues.

site_id

String

ID of the site where the engagement began.

site_name

String

Name of the site where the engagement began.

site_names

Collection

Names of sites visited during an engagement. See site_names.

source

String

Engagement source, one of Engagement sources.

summary_forwarded

Boolean

Whether the summary has already been forwarded.

Yes/No

video_used

Boolean

Whether video was used in the engagement.

Yes/No

visitor_browser

String

Visitor browser

visitor_device_type

String

Visitor device type. Accepted values are mobile and desktop.

visitor_email

String

Visitor email

visitor_id

String

Visitor ID

visitor_last_name

String

Visitor last name

visitor_name

String

Visitor name

visitor_phone

String

Visitor phone

visitor_shared_screen

Boolean

Whether the visitor shared their screen during the engagement.

Yes/No

The following field tags can be used in templates for Inbox Message and Operator Message Exports:

Field

Type

Description

custom_fields

Collection

Visitor’s custom attributes. See custom_fields.

message_id

String

Message ID

message_sent_at

DateTime

Timestamp for when the message was sent.

message

String

Message left by visitor.

site_name

String

Site name

visitor_email

String

Visitor email

visitor_name

String

Visitor name

visitor_phone

String

Visitor phone

The following field tags can be used in templates for Voicemail Exports:

Field

Type

Description

incoming_phone_number

String

The Incoming Phone Number dialed by the visitor.

recording_duration

Integer

Duration of the recording in seconds.

site_id

String

Site ID

visitor_phone_number

String

Visitor phone number

voice_mailbox_id

String

ID of the Voice Mailbox that recorded the voicemail.

voicemail_url

String

URL pointing to the recording of the voicemail.

last_queue_id

String

The ID of the queue that the call was in last. This might be different from the queue that the call started in when the call was transferred to a queue. Note that this field is empty if the call was immediately rejected and never entered the queue.

Collection Tags

Some templated field tags return multiple items, such as operators who participated in an engagement or the custom attributes of a visitor who left an offline message. These are called collection_tags, and generate XML, JSON, or HTML content, depending on the template's content-type. Available collection_tags include:

site_names

XML Template using {site_names} tag

<?xml version='1.0' encoding='utf-8'?><export>{site_names}<export>

XML Output

<?xml version='1.0' encoding='utf-8'?>
<export>
<site>
<name>Company Service Site<name>
</site>
<site>
<name>Company Sales Site<name>
</site>
<export>

JSON Template using {site_names} tag

{"sites": {site_names}}

JSON Output

{
"sites": [
{
"name": "Company Service Site"
},
{
"name": "Company Sales Site"
}
]
}

HTML Template using {site_names} tag

<div class="site-container">{site_names}</div>

HTML Output

<div class="sites">
<div class="sm-site-container">
<div class="sm-site-name-label">Name</div>
<div class="sm-site-name">Company Service Site</div>
</div>
<div class="sm-site-container">
<div class="sm-site-name-label">Name</div>
<div class="sm-site-name">Company Sales Site</div>
</div>
</div>

Available only for Engagement End Exports

Returns the names of sites visited during an engagement. Shown in the right are examples of templates and the formats of their resulting outputs.

Note: For Inbox Message and Operator Message Exports, the {site_names} collection tag is deprecated. Please refer to Field Tags, above, to include a site's name in your export template for these options.

operators

XML Template using {operators} tag

<?xml version='1.0' encoding='utf-8'?><export>{operators}</export>

XML Output

<?xml version='1.0' encoding='utf-8'?>
<export>
<operator>
<name>Jordan Green</name>
<email>jordan.green@company.com</email>
<id>c8b52f0b-ad05-4c71-8c98-5056f07c4d1a</id>
</operator>
<operator>
<name>Jared Grey</name>
<email>jared.grey@company.com</email>
<id>f42811bc-8519-4d33-bbb1-36d4555ecb0a</id>
</operator>
</export>

JSON Template using {operators} tag

{"operators": {operators}}

JSON Output

{
"operators": [
{
"name": "Jordan Green",
"email": "jordan.green@company.com",
"id": "c8b52f0b-ad05-4c71-8c98-5056f07c4d1a"
},
{
"name": "Jared Grey",
"email": "jared.grey@company.com",
"id": "f42811bc-8519-4d33-bbb1-36d4555ecb0a"
}
]
}

HTML Template using {operators} tag

<div class="operators">{operators}</div>

HTML Output

<div class="operators">
<div class="sm-operator-container">
<div class="sm-operator-name-label">Name</div>
<div class="sm-operator-name">Jordan Green</div>
<div class="sm-operator-email-label">Email</div>
<div class="sm-operator-email">jordan.green@company.com</div>
<div class="sm-operator-id-label">id</div>
<div class="sm-operator-id">c8b52f0b-ad05-4c71-8c98-5056f07c4d1a</div>
</div>
<div class="sm-operator-container">
<div class="sm-operator-name-label">Name</div>
<div class="sm-operator-name">Jared Grey</div>
<div class="sm-operator-email-label">Email</div>
<div class="sm-operator-email">jared.grey@company.com</div>
<div class="sm-operator-id-label">id</div>
<div class="sm-operator-id">f42811bc-8519-4d33-bbb1-36d4555ecb0a</div>
</div>
</div>

Available only for Engagement End Exports

Returns operators who participated in the engagement and their unique identifiers. Shown in the right are examples of templates and the formats of their resulting outputs.

queues

XML Template using {queues} tag

<?xml version='1.0' encoding='utf-8'?><export>{queues}</export>

XML Output

<?xml version='1.0' encoding='utf-8'?>
<export>
<queue>
<name>Default Queue</name>
<id>82af2b5d-4ea5-40c8-bab2-a87d39598a81</id>
</queue>
<queue>
<name>Priority Queue</name>
<id>d3fe1379-f113-4285-80cf-16f5b924ca24</id>
</queue>
</export>

JSON Template using {queues} tag

{"queues": {queues}}

JSON Output

{
"queues": [
{
"name": "Default Queue",
"id": "82af2b5d-4ea5-40c8-bab2-a87d39598a81"
},
{
"name": "Priority Queue",
"id": "d3fe1379-f113-4285-80cf-16f5b924ca24"
}
]
}

HTML Template using {queues} tag

<div class="queues">{queues}</div>

HTML Output

<div class="queues">
<div class="sm-queue-container">
<div class="sm-queue-name-label">Name</div>
<div class="sm-queue-name">Default Queue</div>
<div class="sm-queue-id-label">id</div>
<div class="sm-queue-id">82af2b5d-4ea5-40c8-bab2-a87d39598a81</div>
</div>
<div class="sm-queue-container">
<div class="sm-queue-name-label">Name</div>
<div class="sm-queue-name">Priority Queue</div>
<div class="sm-queue-id-label">id</div>
<div class="sm-queue-id">d3fe1379-f113-4285-80cf-16f5b924ca24</div>
</div>
</div>

Available for Engagement Start Exports and Engagement End Exports

A list of queues that the visitor was enqueued in before starting the engagement. This collection tag will be populated only for reactive engagements started started via queueing. Shown in the right are examples of templates and the formats of their resulting outputs.

custom_fields

XML Template using {custom_fields} tag

<?xml version='1.0' encoding='utf-8'?><export>{custom_fields}</export>

XML Output

<?xml version='1.0' encoding='utf-8'?>
<export>
<field>
<key>VIP</key>
<value>false</value>
</field>
<field>
<key>profession</key>
<value>teacher</value>
</field>
</export>

JSON Template using {custom_fields} tag

{"custom_fields": {custom_fields}}

JSON Output

{
"custom_fields": [
{
"key": "VIP",
"value": "false"
},
{
"key": "profession",
"value": "teacher"
}
]
}

HTML Template using {custom_fields} tag

<div class="custom-fields">{custom_fields}</div>

HTML Output

<div class="custom-fields">
<div class="sm-custom-attributes-container">
<div class="sm-custom-key-label">Key</div>
<div class="sm-custom-key">profession</div>
<div class="sm-custom-key-value-label">Value</div>
<div class="sm-custom-key-value">teacher</div>
</div>
</div>

Available for Engagement Start Exports, Engagement Transfer Exports, Engagement End Exports, Inbox Messages and Operator Messages

A collection of the visitor's custom attributes. Shown in the right are examples of templates and the formats of their resulting outputs.

chat_transcript

XML Template using {chat_transcript} tag

<?xml version='1.0' encoding='utf-8'?><export>{chat_transcript}</export>

XML Output

<?xml version='1.0' encoding='utf-8'?><export>
<message>
<content>Hi, where can I add a new plan for my daughter?</content>
<attachment/>
<created_at>2017-07-07T13:47:28.000Z</created_at>
<sender>
<name>Mark White</name>
<type>visitor</type>
</sender>
</message>
<message>
<content>Why don't I take you there?</content>
<attachment/>
<created_at>2017-07-07T13:47:29.000Z</created_at>
<type>suggestion</type>
<sender>
<name>omniguide</name>
<type>omniguide</type>
</sender>
</message>
<message>
<content>Why don't I take you there?</content>
<attachment/>
<created_at>2017-07-07T13:47:30.000Z</created_at>
<sender>
<name>Jared Grey</name>
<type>operator</type>
</sender>
</message>
</export>

Message attachments are included in the export. Below are examples for every type of attachment.

Example of message with single_choice attachment

<message>
<content>Please choose one of the options.</content>
<attachment>
<type>single_choice</type>
<options>
<option>
<text>Choice 1</text>
<value>choice_1</value>
</option>
<option>
<text>Choice 2</text>
<value>choice_2</value>
</option>
</options>
<attachment/>
<created_at>2017-01-14T20:34:2205:00</created_at>
<sender>
<name>Jared Grey</name>
<type>operator</type>
</sender>
</message>

Example of message with single_choice_response attachment

<message>
<content>Choice 1</content>
<attachment>
<type>single_choice_response</type>
<selected_option>choice_1</selected_option>
<attachment/>
<created_at>2017-01-14T20:34:2205:00</created_at>
<sender>
<name>Visitor</name>
<type>visitor</type>
</sender>
</message>

Example of message with files attachment

<message>
<content>I am sending you a pdf file!</content>
<attachment>
<type>files</type>
<files>
<file>
<name>record.pdf</name>
<content_type>application/pdf</content_type>
<url>https://url-something</url>
<deleted>false</deleted>
</file>
</files>
<attachment/>
<created_at>2017-01-14T20:34:2205:00</created_at>
<sender>
<name>Visitor</name>
<type>visitor</type>
</sender>
</message

JSON Template using {chat_transcript} tag

{"chat": {chat_transcript}}

JSON Output

{
"chat_transcript": [
{
"content": "Hi, where can I add a new plan for my daughter?",
"attachment": null,
"created_at": "2017-07-07T13:47:28.000Z",
"sender": {
"name": "Mark White",
"type": "visitor"
}
},
{
"content": "Why don't I take you there?",
"attachment": null,
"created_at": "2017-07-07T13:47:29.000Z",
"type": "suggestion",
"sender": {
"name": "omniguide",
"type": "omniguide"
}
},
{
"content": "Why don't I take you there?",
"attachment": null,
"created_at": "2017-07-07T13:47:30.000Z",
"type": "user",
"sender": {
"name": "Jared Grey",
"type": "operator"
}
}
]
}

Message attachments are included in the export. Attachments are formatted the same way as in chat transcript. See Chat Transcript for further information.

For example

{
"chat_transcript": [
{
"content": "Hi, I'm sending you a pdf!",
"attachment": {
"type": "files",
"files": [
{
"name": "billing.pdf",
"content_type": "application/pdf",
"url": "http://api.salemove.com/engagements/.../files/...pdf",
"deleted": false
}
]
},
"created_at": "2017-07-07T13:47:28.000Z",
"sender": {
"name": "Mark White",
"type": "visitor"
}
}
]
}

HTML Template using {chat_transcript} tag

<div class="chat-transcript">{chat_transcript}</div>

HTML Output

<div class="chat-transcript">
<div style="font-size: 12px">
<div
style="float: left; margin-right: 3px; margin-top: -3px; font-weight: bold; color: rgb(98, 140, 216); clear: left"
>
[03:45PM]
</div>
<div
style="float: left; margin-right: 3px; margin-top: -3px; font-weight: bold; color: rgb(98, 140, 216)"
>
Stenver
</div>
<div style="float: left; margin-top: -3px">First message</div>
</div>
<div style="font-size: 12px">
<div
style="float: left; margin-right: 3px; margin-top: -3px; font-weight: bold; color: rgb(75, 118, 73); clear: left"
>
[03:46PM]
</div>
<div
style="float: left; margin-right: 3px; margin-top: -3px; font-weight: bold; color: rgb(75, 118, 73)"
>
Markus
</div>
<div style="float: left; margin-top: -3px">Second message</div>
<span style="font-weight: bold">Attached files:</span>
<div><a href="http://access-to-image">first.png</a></div>
<div>second.pdf</div>
</div>
</div>

Attachments with type files are shown in HTML. However, single_choice and single_choice_response are not.

Note that in the example, one message contains files attachment. The file names with URL to download the file will be shown. When the file is no longer available, only file name is shown.

Available only for Engagement End Exports

The collection of chat messages exchanged between the visitor and the operator, including system messages the operator received during the engagement. Shown in the right are examples of templates and the formats of their resulting outputs.

Examples

XML Template

<?xml version='1.0' encoding='utf-8'?>
<export>
<visitor_name>{visitor_name}</visitor_name>
<chat>{chat_transcript}</chat>
</export>

Output

<?xml version='1.0' encoding='utf-8'?>
<export>
<visitor_name>Jared Grey</visitor_name>
<chat>
<message>
<content>Hi, where can I add a new plan for my daughter?</content>
<attachment/>
<created_at>2017-01-14T20:34:2200:00</created_at>
<sender>
<name>Mark White</name>
<type>visitor</type>
</sender>
</message>
<message>
<content>Why don't I take you there?</content>
<attachment/>
<created_at>2017-01-14T20:34:2205:00</created_at>
<sender>
<name>Jared Grey</name>
<type>operator</type>
</sender>
</message>
</chat>
</export>

JSON Template

{
"export": {
"visitor_name": {visitor_name},
"chat": {chat_transcript},
"custom_fields": {custom_fields}
}
}

Output

{
"export": {
"visitor_name": "Mark White",
"chat": [
{
"content": "Hi, where can I add a new plan for my daughter?",
"attachment": null,
"created_at": "2017-01-14T20:34:1807:00",
"sender": {
"name": "Mark White",
"type": "Visitor"
}
},
{
"content": "Why don't I take you there?",
"attachment": null,
"created_at": "2017-01-14T20:34:2205:00",
"sender": {
"name": "Jared Grey",
"type": "Operator"
}
}
],
"custom_fields": [
{
"key": "VIP",
"value": "false"
},
{
"key": "profession",
"value": "teacher"
}
]
}
}

Template

<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML export template</title>
</head>
<body>
<p>Visitor: {visitor_name}</p>
<h2>Chat transcript</h2>
{chat_transcript}
<h2>Custom attributes</h2>
{custom_attributes}
</body>
</html>

Generates the Output

<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML export template</title>
</head>
<body>
<p>Visitor: Markus</p>
<h2>Chat transcript</h2>
<div style="font-size: 12px">
<div
style="float: left; margin-right: 3px; margin-top: -3px; font-weight: bold; color: rgb(98, 140, 216); clear: left"
>
[03:45PM]
</div>
<div
style="float: left; margin-right: 3px; margin-top: -3px; font-weight: bold; color: rgb(98, 140, 216)"
>
Stenver
</div>
<div style="float: left; margin-top: -3px">First message</div>
</div>
<div style="font-size: 12px">
<div
style="float: left; margin-right: 3px; margin-top: -3px; font-weight: bold; color: rgb(75, 118, 73); clear: left"
>
[03:46PM]
</div>
<div
style="float: left; margin-right: 3px; margin-top: -3px; font-weight: bold; color: rgb(75, 118, 73)"
>
Markus
</div>
<div style="float: left; margin-top: -3px">Second message</div>
</div>
<h2>Custom attributes</h2>
<div class="sm-custom-attributes-container">
<div class="sm-custom-key-label">Key</div>
<div class="sm-custom-key">custom key 1</div>
<div class="sm-custom-key-value-label">Value</div>
<div class="sm-custom-key-value">custom value 1</div>
</div>
<div class="sm-custom-attributes-container">
<div class="sm-custom-key-label">Key</div>
<div class="sm-custom-key">custom key 2</div>
<div class="sm-custom-key-value-label">Value</div>
<div class="sm-custom-key-value">custom value 2</div>
</div>
</body>
</html>

POST New Export

cURL
Untitled
Untitled
cURL
curl --request POST \
--header "Authorization: Bearer $access_token" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.salemove.v1+json" \
--data-binary '{
"name": "Lead Gen",
"type": "engagement",
"content_type": "application/xml",
"email_recipient": {
"enabled": true,
"emails": ["jared.grey@company.com"]
},
"crm_recipient": {
"enabled": true,
"url": "https://company.com/crm"
},
"template": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<export><visitor_name>{visitor_name}</visitor_name>\n</export>"
}' \
"https://api.salemove.com/sites/$site_id/crm/exports/"
Untitled
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();
xhr.open(
'POST',
`https://api.salemove.com/sites/${site_id}/crm/exports`,
false
);
xhr.setRequestHeader('authorization', `Bearer ${accessToken}`);
xhr.setRequestHeader('content-type', 'application/json');
xhr.setRequestHeader('accept', 'application/vnd.salemove.v1+json');
var data = {
name: 'Lead Gen',
type: 'engagement',
content_type: 'application/xml',
email_recipient: {
enabled: true,
emails: ['sales@company.com']
},
crm_recipient: {
enabled: true,
url: 'https://company.com/crm',
headers: {
Authorization: 'CRM_Auth_Token',
Accept: 'application/xml'
}
},
template:
'<?xml version="1.0" encoding="UTF-8"?>\n<export><visitor_name>{visitor_name}</visitor_name>\n</export>'
};
var query = JSON.stringify(data);
xhr.send(query);
var response = JSON.parse(xhr.responseText);
console.log(response);
Untitled
require 'httparty'
ENDPOINT = 'https://api.salemove.com/sites'
token = ARGV[0].strip
site_id = ARGV[1].strip
headers = {
:authorization => "Bearer #{access_token}",
:content_type => "application/json",
:accept => "application/vnd.salemove.v1+json"
}
options = {
headers: headers,
query: {
"name": "Lead Gen",
"type": "engagement",
"content_type": "application/xml",
"email_recipient": {
"enabled": false,
"emails": [
"sales@company.com"
]
},
"crm_recipient": {
"enabled": true,
"url": "https://company.com/crm",
"headers": {
"Authorization": "CRM_Auth_Token",
"Accept": "application/xml"
}
},
"template": "<?xml version='1.0' encoding='UTF-8'?><export><visitor_name>{visitor_name}</visitor_name></export>",
"enabled": true,
"send_to_operator": true,
"trigger": "system",
"folder_id": "86313e78-a521-42c0-9477-97f5c4565fc8",
"email_subject": "Glia engagement with {visitor_name}"
}
}
raw_response = HTTParty.post(
"#{ENDPOINT}/#{site_id}/crm/exports",
options
)
response = JSON.parse raw_response.body
puts response

Generates the output

{
"id": "efae435b-2ec5-403f-a091-46ecf1b8894b",
"folder_id": null,
"name": "New Lead",
"site_id": "2e56b224-6708-4755-b6c9-35f9889e42dd",
"type": "engagement",
"content_type": "application/xml",
"template": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<export><visitor_name>{visitor_name}</visitor_name>\n</export>",
"email_subject": null,
"created_at": "2017-07-10T19:36:40.548207Z",
"updated_at": "2017-07-10T19:36:40.548207Z",
"enabled": true,
"updated_by": "manager@company.com",
"send_to_operator": true,
"trigger": "system",
"crm_recipient": {
"enabled": true,
"url": "https://company.com/crm",
"headers": {
"Accept": "application/xml",
"Authorization": "CRM_Auth_Token"
}
},
"email_recipient": {
"enabled": true,
"emails": ["sales@company.com"]
},
"href": "https://api.salemove.com/sites/2e56b224-6708-4755-b6c9-35f9889e42dd/crm/exports/5681e1d2-f7ac-4473-9809-2965bfd8ef02"
}

Action: POST /sites/{site_id}/crm/exports

Creates a new export for the site with the ID {site_id}. The user making the request must have the super_manager role on the given site.

The endpoint accepts the following parameters:

Parameter

Required

Type

Description

site_id

Yes

String

The site_id that owns the export.

name

Yes

String

Look at the template definition for the description of this parameter.

type

Yes

String

Look at the template definition for the description of this parameter.

content_type

Yes

String

Look at the template definition for the description of this parameter.

email_recipients

Yes

Object

Look at the template definition for the description of this parameter.

crm_recipients

Yes

Object

Look at the template definition for the description of this parameter.

template

Yes

String

Look at the template definition for the description of this parameter.

GET Export by ID

cURL
Untitled
Untitled
cURL
curl --request GET \
--header "Authorization: Bearer $access_token" \
--header "Accept: application/vnd.salemove.v1+json" \
"https://api.salemove.com/sites/$site_id/crm/exports/$export_id"
Untitled
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();
xhr.open(
'GET',
`https://api.salemove.com/sites/${site_id}/crm/exports/${export_id}`,
false
);
xhr.setRequestHeader('authorization', `Bearer ${accessToken}`);
xhr.setRequestHeader('accept', 'application/vnd.salemove.v1+json');
xhr.send();
var response = JSON.parse(xhr.responseText);
console.log(response);
Untitled
require 'httparty'
ENDPOINT = 'https://api.salemove.com/sites'
token = ARGV[0].strip
site_id = ARGV[1].strip
export_id = ARGV[2].strip
headers = {
:authorization => "Bearer #{access_token}",
:accept => "application/vnd.salemove.v1+json"
}
raw_response = HTTParty.get(
"#{ENDPOINT}/#{site_id}/crm/exports/#{export_id}",
headers: headers
)
response = JSON.parse raw_response.body
puts response

Generates the output

{
"href": "https://api.salemove.com/sites/2e56b224-6708-4755-b6c9-35f9889e42dd/crm/exports/5681e1d2-f7ac-4473-9809-2965bfd8ef02",
"id": "5681e1d2-f7ac-4473-9809-2965bfd8ef02",
"name": "New Lead",
"site_id": "2e56b224-6708-4755-b6c9-35f9889e42dd",
"type": "engagement",
"content_type": "application/xml",
"email_recipient": {
"enabled": true,
"emails": ["sales@company.com"]
},
"crm_recipient": {
"enabled": true,
"url": "http://company.com/crm",
"headers": {
"Accept": "application/xml",
"Authorization": "CRM_Auth_Token"
}
},
"template": "<?xml version='1.0' encoding='UTF-8'?>\n<export><visitor_name>{visitor_name}</visitor_name>\n</export>",
"enabled": true,
"updated_by": "manager@email.com",
"send_to_operator": true,
"trigger": "system",
"created_at": "2017-07-06T09:24:22Z",
"updated_at": "2017-07-06T09:24:22Z",
"folder_id": null,
"email_subject": "Glia engagement with {visitor_name}"
}

Action: GET /sites/{site_id}/crm/exports/{id}

This fetches the information for the export with the ID {id}. The user whose bearer access token is used to make the request must have at least manager role on the given site.

Parameter

Required

Type

Description

site_id

Yes

String

The site_id that owns the export definition.

id

Yes

String

The id of the export.

PUT Update Export

cURL
Untitled
Untitled
cURL
curl --request PUT \
--header "Authorization: Bearer $access_token" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.salemove.v1+json" \
--data-binary '{
"name": "Lead Bucket",
"type": "engagement",
"content_type": "application/xml",
"email_recipient": {
"enabled": true,
"emails": ["sales@company.com","manager@company.com"]
},
"crm_recipient": {
"enabled": true,
"url": "https://company.com/crm",
"headers": {
"Authorization": "Basic sAAA3tdMgcDoFOHA1WTdyMg==",
"Accept": "application/xml"
}
},
"template": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<export><visitor_name>{visitor_name}</visitor_name>\n</export>",
"email_subject": "New Glia Lead",
"send_to_operator": false,
"trigger": "system",
"folder_id": "86313e78-a521-42c0-9477-97f5c4565fc8"
}' \
"https://api.salemove.com/sites/$site_id/crm/exports/$export_id"
Untitled
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();
xhr.open(
'PUT',
`https://api.salemove.com/sites/${site_id}/crm/exports/${export_id}`,
false
);
xhr.setRequestHeader('authorization', `Bearer ${accessToken}`);
xhr.setRequestHeader('content-type', 'application/json');
xhr.setRequestHeader('accept', 'application/vnd.salemove.v1+json');
var data = {
name: 'Lead Bucket',
type: 'engagement',
content_type: 'application/xml',
email_recipient: {
enabled: true,
emails: ['sales@company.com', 'manager@company.com']
},
crm_recipient: {
enabled: true,
url: 'https://company.com/crm',
headers: {
Authorization: 'Basic sAAA3tdMgcDoFOHA1WTdyMg==',
Accept: 'application/xml'
}
},
template:
'<?xml version="1.0" encoding="UTF-8"?>\n<export><visitor_name>{visitor_name}</visitor_name>\n</export>',
email_subject: 'New Glia Lead',
send_to_operator: false,
trigger: 'system',
folder_id: '86313e78-a521-42c0-9477-97f5c4565fc8'
};
var query = JSON.stringify(data);
xhr.send(query);
var response = JSON.parse(xhr.responseText);
console.log(response);
Untitled
require 'httparty'
ENDPOINT