XML Descriptions for Integration Template
Yeastar P-Series PBX System allows you to create CRM/Helpdesk integration templates, where you can define the necessary settings, including specific API endpoints, data fields, and functional scenarios required for the integration. This topic provides detailed description of the setting elements in the XML templates.
Template conventions
The template follows the XML 1.1 standard specification. This section describes the syntax and conventions of the template.
- Variable
- The template supports the use of variables for dynamic data. When the template is executed, the variables referenced within the template will be replaced with their respective values.
- Function
- The template supports the following function, which can be used in
conjunction with variables to dynamically manipulating or formatting the
variable value.
Function Description TimeFormat The function can be used to customize the format of a timestamp. Format: {{ TimeFormat Timestamp_variable "format_string" "Whether_to_convert_to_UTC_time" }}
Example:
{{ TimeFormat .StartTimeUnix "yyyy-MM-ddTHH:mm:ss.000Zz" "1" }}
Assuming the value of {{.StartTimeUnix}} is
1672531199
, the final output would be2023-01-01T00:59:59.000Z
.ToMillis The function can be used to convert a seconds timestamp to a milliseconds timestamp. Format: {{ ToMillis Timestamp_variable}}
Example:
{{ ToMillis .StartTimeUnix }}
Assuming the value of {{.StartTimeUnix}} is
1672531199
, the final output would be1672531199000
.Capitalize The function can be used to capitalizes the first letter of a string. Format: {{ Capitalize variable_string}}
Example:
{{ Capitalize .variable_string }}
Assuming the value of {{.variable_string}} is
hello world
, the final output would beHello world
.UrlEncode The function can be used to URL encode a string. Format: {{ UrlEncode .variable }}
Example:
{{ UrlEncode .variable}}
Assuming the value of {{.variable_string}} is
hello world!
, the final output would behello%20world%21
. - Elements
- The templates offers the following main elements that help define the integration interactions, ensuring that the template can seamlessly connect with the third-party system and process data based on integration requirements.
Template property
The <Information>
element provides the properties of the
template, including the basic template information and configuration overview, as
listed below:
Attribute | Description |
---|---|
Provider | The type of the template, with a fixed value of
crm or helpdesk . |
Name | The name of the template. |
Key | Unique identifier for the template. |
Logo | The filename of the logo. |
Remark | A description or remark about the template. |
Version | The version of the template. E.g.
1.0.0 . |
AuthType | The authentication method used in the integration.
|
MaxConcurrentRequest | The maximum number of concurrent HTTP requests allowed to the CRM/Helpdesk. |
UserAssociation | Whether the User Association feature is enabled or not.
|
CallJournal | Whether the Call Journal feature is enabled or not.
|
CreateNewContact | Whether the Create New Contact feature is enabled or not.
|
CreateNewTicket | Whether the Create New Ticket Automatically feature is
enabled or not.
|
Authentication scenario
This scenario defines the authentication method used by the CRM/Helpdesk system. The structure of the scenario and its key elements are outlined as below:
<Scenario Id="AuthMethod" Type="AUTH">
<Presets></Presets>
<Parameters>
<Parameter Name="AuthMethod" Value="oauth2"></Parameter>
<Parameter Name="AuthEndPoint" Value="https://api.example.com/oauth/v2/auth?client_id={{.client_id}}"></Parameter>
<Parameter Name="TokenEndPoint" Value="https://api.example.com/oauth/v2/token?client_id={{.client_id}}&client_secret={{.client_secret}}"></Parameter>
<Parameter Name="AdditionalQueryString"></Parameter>
<Parameter Name="Scope" Value="contacts.read,contacts.write,calls.read,calls.write,user.read,user.write"></Parameter>
<Parameter Name="CredentialType"></Parameter>
<Parameter Name="Base64EncodedCredential"></Parameter>
<Parameter Father="CustomFieldList" Name="client_id" Editor="password" Title="Client ID"></Parameter>
<Parameter Father="CustomFieldList" Name="client_secret" Editor="password" Title="Client Secret"></Parameter>
</Parameters>
<Requests></Requests>
</Scenario>
Here is a detailed explanation of the specific elements within the scenario.
- Scenario element
- The
<Scenario>
element has the following attributes: - Parameter element
-
Attribute Description Name The name of the authentication parameter. Value The value of the authentication parameter. Father The name of a parent parameter (should be fixed as CustomFieldList
), which serves as a container for the following child parameters, organizing custom fields that allow users to input values for the associated parameters in the configuration UI.Note: The variables captured in the custom fields are accessible for all the subsequent requests in the template.Name
: The variable name of the custom field, which can be reference in the template.Editor
: The type of the custom field.Valid value:
string
: A standard input field where users can enter plain text.password
: A specialized input field for sensitive information, with text masked for privacy.list
: A selectable list that allows users to choose from a pre-defined list of options.
Title
: The title of the custom field.Value
: The pre-defined list of options.
User association scenario
This scenarios is used to retrieve the list of users from the CRM/Helpdesk system. The structure of the scenario and its key elements are outlined as below:
<Scenario Id="UserAssociation" Type="REST">
<Parameters></Parameters>
<Requests>
<Request Name="UserAssociation" Method="GET" ResponseType="application/json" RequestEncoding="" URLFormat="https://www.api.example.com/v1/users?type=ActiveUsers">
<Parameters></Parameters>
<Outputs>
<Output Name="UserUniqueId" Path="users.#.id" Type=""></Output>
<Output Name="FirstName" Path="users.#.First_Name" Type=""></Output>
<Output Name="LastName" Path="users.#.Last_Name" Type=""></Output>
<Output Name="Email" Path="users.#.Email" Type=""></Output>
</Outputs>
</Request>
</Requests>
</Scenario>
Here is a detailed explanation of the specific elements within the scenario.
- Scenario element
- The
<Scenario>
element has the following attributes: - Request element
- The
<Request>
element has the following attributes:
- Output element
- The
<Output>
element has the following attributes:
Automatic contact synchronization scenario
This scenarios is used to search for contacts in the CRM/Helpdesk system, and the returned information can be used to implement CRM contacts searching, automatic contact synchronization and call popup. The structure of the scenario and its key elements are outlined as below:
<Scenario Id="SyncContactAuto" Type="REST">
<Presets></Presets>
<Parameters>
<Parameter Name="ContactUrlType" Value="retrieve_from_contact"></Parameter>
<Parameter Name="URLFormat"></Parameter>
<Parameter Name="ContactFieldForUri" Value="data.#.contactUrl"></Parameter>
<Parameter Name="ContactsIdEnable" Value="1"></Parameter>
<Parameter Name="FirstNameEnable" Value="1"></Parameter>
<Parameter Name="BusinessNumberEnable" Value="1"></Parameter>
<Parameter Name="CustomValueEnable" Value="0"></Parameter>
</Parameters>
<Requests>
<Request Name="Contacts" Method="GET" ResponseType="application/json" RequestEncoding="" URLFormat="https://www.api.example.com/v1/Contacts/search?criteria=((Phone:equals:{{.Phone}})or(Home_Phone:equals:{{.Phone}})or(Mobile:equals:{{.Phone}})or(Asst_Phone:equals:{{.Phone}}))">
<Parameters></Parameters>
<Outputs>
<Output Name="ContactsId" Path="data.#.id" Type=""></Output>
<Output Name="FirstName" Path="data.#.First_Name" Type=""></Output>
<Output Name="BusinessNumber" Path="data.#.Phone" Type=""></Output>
...
<Output Name="CustomValue" Path="data.#.Owner" Type=""></Output>
</Outputs>
</Request>
</Requests>
</Scenario>
Here is a detailed explanation of the specific elements within the scenario.
- Scenario element
- The
<Scenario>
element has the following attributes: - Parameter element
- The
<Parameter>
element provides has the following attributes: - Request element
- The
<Request>
element has the following attributes:
- Output element
- The
<Output>
element has the following attributes:
Automatic contact creation scenario
This scenarios is used to create a new contact in the CRM/Helpdesk system when the caller’s number does not match any existing contact. The structure of the scenario and its key elements are outlined as below:
<Scenario Id="CreateNewContact" Type="REST">
<Parameters></Parameters>
<Requests>
<Request Name="Contacts" Method="POST" ResponseType="application/json" RequestEncoding="" URLFormat="https://www.api.example.com/v1/Contacts">
<Parameters>
<Parameter Name="Data" Type="Body" Value="{"data": [{"Last_Name":"{{.LastName}}","First_Name":"{{.FirstName}}","Phone":"{{.BusinessNumber}}";}]}"></Parameter>
</Parameters>
<Outputs></Outputs>
</Request>
</Requests>
</Scenario>
Here is a detailed explanation of the specific elements within the scenario.
- Scenario element
- The
<Scenario>
element has the following attributes: - Request element
- The
<Request>
element has the following attributes:
- Parameter element
- The
<Parameter>
element nested within the<Request>
element defines the parameters included in the request body.Attribute Description Name The name of the parameter, which should be fixed as Data
.Type The type of the parameter, which should be fixed as Body
.Value Defines the required parameters to be passed through the request body, within a data
structure. The parameter values can be retrieved from the pre-defined variables in the PBX system.Note: The format should follows XML parameter standards. For example, if a line break is required, you must use the escape character

to represent a newline.
Automatic ticket creation scenario (for Helpdesk system only)
This scenarios is used to create a new ticket in the Helpdesk system. The structure of the scenario and its key elements are outlined as below:
<Scenario Id="CreateNewTicket" Type="REST" >
<Presets></Presets>
<Parameters>
<Parameter Name="EnableSubject" Value="1"></Parameter>
<Parameter Name="Subject" Value="{{.Communication_Type}} {{.Call_Status}} - from {{.Call_From}} to {{.Call_To}}"></Parameter>
<Parameter Name="EnableDescription" Value="1"></Parameter>
<Parameter Name="Description" Value="{{.Time}} {{.Communication_Type}} {{.Call_Status}} - from {{.Call_From}} to {{.Call_To}} {{.Talk_Duration}}"></Parameter>
</Parameters>
<Requests>
<Request Name="CreateNewTicket" Method="POST" Weight="0" ResponseType="application/json" RequestEncoding="" URLFormat="https://{{.domain}}/api/v1/tickets">
<Parameters>
<Parameter Name="Data" Type="Body" Value="{"subject":"{{.Subject}}","contactId":"{{.ContactId}}","phone":"{{.ContactNumber}}","description":"{{.Description}}";}"></Parameter>
</Parameters>
<Outputs></Outputs>
</Request>
</Requests>
</Scenario>
Here is a detailed explanation of the specific elements within the scenario.
- Scenario element
- The
<Scenario>
element has the following attributes: - Parameter element
-
Attribute Description Name The name of the configuration settings used in the scenario. Value The value of the configuration settings. Configuration settingsSettings Description EnableSubject Whether to allow users to customize the subject of the ticket. Valid value:0
: Disable.1
: Enable.
Subject Specify the default value of the subject. Note: The default value is{{.Communication_Type}} {{.Call_Status}} - from {{.Call_From}} to {{.Call_To}}
. For more supported variables, see the parameter variable list.EnableDescription Whether to allow users to customize the description of the ticket. Valid value:0
: Disable.1
: Enable.
Description Specify the default value of the description. Note: The default value is{{.Time}} {{.Communication_Type}} {{.Call_Status}} - from {{.Call_From}} to {{.Call_To}} {{.Talk_Duration}}
. For more supported variables, see the parameter variable list. - Request element
- The
<Request>
element has the following attributes:
- Parameter element
- The
<Parameter>
element nested within the<Request>
element defines the parameters included in the request body.Attribute Description Name The name of the parameter, which should be fixed as Data
.Type The type of the parameter, which should be fixed as Body
.Value Defines the required parameters to be passed through the request body. The parameter values can be retrieved from the pre-defined variables in the PBX system. Note: The format should follows XML parameter standards. For example, if a line break is required, you must use the escape character

to represent a newline.
Call journal scenario
This scenarios is used to log the call activities of associated users to the CRM / Helpdesk. The structure of the scenario and its key elements are outlined as below:
<Scenario Id="CallJournal" Type="REST">
<Presets></Presets>
<Parameters>
<Parameter Name="EnableSubject" Value="1"></Parameter>
<Parameter Name="Subject" Value="Extension Call"></Parameter>
<Parameter Name="EnableDescription" Value="1"></Parameter>
<Parameter Name="Description" Value="Call: {{.Time}} {{.Call_Log_Status}} from {{.Call_From}} to {{.Call_To}} {{.Talk_Duration}}"></Parameter>
<Parameter Name="EnablePlayCallRecording" Value="1"></Parameter>
<Parameter Name="PlayCallRecording" Value="0"></Parameter>
</Parameters>
<Requests>
<Request Name="CallJournal" Method="POST" Weight="0" ResponseType="application/json" RequestEncoding="" URLFormat="https://www.api.example.com/crm/v2/Calls">
<Parameters>
<Parameter Name="Data" Type="Body" Value="{"data"[{"{{.Owner}}{{.WhoModule}}": {"Description":"{{.Description}}","Voice_Recording__s":"{{.RecordPath}}","Call_Start_Time":"{{TimeFormat .StartTimeUnix "yyyy-MM-ddTHH:mm:ss-z" "1"}}","Subject&":"{{.Subject}}","Call_Type": "Inbound","Call_Result": "{{.Call_Log_Status}}","Call_Duration": "{{.Talk_Duration_Sec}}"}}]}"></Parameter>
</Parameters>
<Outputs></Outputs>
</Request>
</Requests>
</Scenario>
Here is a detailed explanation of the specific elements within the scenario.
- Scenario element
- The
<Scenario>
element has the following attributes: - Parameter element
-
Attribute Description Name The name of the configuration settings used in the scenario. Value The value of the configuration settings. Configuration settingsSettings Description EnableSubject Whether to allow users to customize the subject of the call log. Valid value:0
: Disable.1
: Enable.
Subject Specify the default value of the subject. Note: The default value isExtension Call
, you can also specify the subject using the supported variables.EnableDescription Whether to allow users to customize the description of the call log. Valid value:0
: Disable.1
: Enable.
Description Specify the default value of the description. Note: The default value is{{.Time}} {{.Communication_Type}} {{.Call_Status}} - from {{.Call_From}} to {{.Call_To}} {{.Talk_Duration}}
. For more supported variables, see the parameter variable list.EnablePlayCallRecording Whether to allow users to configure the option for playing call recordings in the CRM. Valid value:0
: Disable.1
: Enable.
PlayCallRecording Specify the default status of the call recording playback option. Valid value:0
: Disable.1
: Enable.
- Request element
- The
<Request>
element has the following attributes:
- Parameter element
- The
<Parameter>
element nested within the<Request>
element defines the parameters included in the request body.Attribute Description Name The name of the parameter, which should be fixed as Data
.Type The type of the parameter, which should be fixed as Body
.Value Defines the required parameters to be passed through the request body. The parameter values can be retrieved from the pre-defined variables in the PBX system. Note: The format should follows XML parameter standards. For example, if a line break is required, you must use the escape character

to represent a newline.
Extended configurations
- Set custom request headers
- If custom request headers are needed, you can add parameter(s) with the
type set to
Header
. This will add the headers to the request body. - Identify token errors
- In the
AuthMethod
scenario, you can add a parameterTokenInvalid
to help identify whether the issue in the request is related to the token or other underlying problems. - Retrieve additional variables for global use
- If
you require additional variables beyond the provided ones, if you want
to use certain common information globally during the integration
process, you can define a
GetGlobalInfo
scenario and set up the related requests to retrieve the necessary values. - Supplement contact query information
- If the initial query for contact information does not return all the necessary information you need, further queries may be required using the returned contact ID or other contact information.
- Retrieve TicketID for further operations
- In a Helpdesk integration template, you can configure additional settings to retrieve the ticket ID for subsequent operations, such as updating the ticket or referencing the variable in call journal.