API APRO CRM
Basic Features
This API provides the access to the CRM and Intranet data.
Requests should be sent to: http://domainname.crma.pro:81/sharedapi/[object_type]/[subtype],
where domainname should be replaced by your CRM domain name.
Any request should comprise an access key of 32 characters. For example:
Any request should comprise an access key of 32 characters. For example:
{
apikey: /* 32 characters key */,
params: /* associative array of parameters */
}
The response is available in JSON format.
A correct request will render the following response:
{
status: "success",
data: /* object */
}
An error request will render the following response:
{
status: "fail",
message: /* error code */
}
Error codes:
- ACCESS_DENY - access denied
- LIMIT_EXCEEDED - requests limit exceeded
- BAD_REQUEST - invalid object request
- BAD_PARAMS - invalid request parameters
Attention!
Default limits are as follows:- - the number of requests must not exceed 200 per hour (can be extended upon request);
- - the number of array elements in a request, including the inclosed ones, must not exceed 1000.
Attention!
In case of connection errors, try to use port 80 as an alternative.
Data format
Uploading selection options
Uploading selection options attributed to specific values
radio | Yes(1) No(0) selection |
select | Single choice |
multiselect | Multiple choice |
date | Date 2014-03-14 |
datetime | Date 2014-03-14 21:34:05 |
time | Time 21:34:05 |
integer | Integer |
decimal | Decimal |
text | Text |
price | Price |
file |
Link to file - for objects images /files/crm/product/$filename - original /files/crm/product/resized200x200/$filename - small /files/crm/product/resized800x600/$filename - big other /files/crm/product/$filename - for other files /files/crm/$filename |
point | geocoordinate 55.753366 37.620908 |
integer_range | Integer range: from - to |
decimal_range | Decimal range: from - to |
date_range | Date range: from - to |
time_range | Time range: from - to |
datetime_range | Date+time range: from - to |
Attention!
By default, the fields of type "select" and "multiselect", conditioned on the selection of the parent fields (nested_selects), are not rendered for objects and activities requested. They should be uploaded manually, as the number of selection options can reach up to several thousands.Uploading selection options
URL: | http://domainname.crma.pro:81/sharedapi/utils/variants |
Github | method: getSelectVariants |
Params: |
property_id - selection field ID |
URL: | http://domainname.crma.pro:81/sharedapi/utils/binded |
Github | method: getBindedSelectVariants |
Params: |
bind - selection field ID |
Obtaining the list of posts. Posts can be enclosed, or form sections.
URL: | http://domainname.crma.pro:81/sharedapi/publication/list |
Github | method: getArticlesList |
Params: |
parent_id - parent field ID (obligatory field, root = 0) |
Response: |
{
|
Obtaining a post
URL: | http://domainname.crma.pro:81/sharedapi/publication/single |
Github | method: getArticleContent |
Params: |
id - post ID |
Response: |
{
|
Requesting data from online form fields. All requests should be sent by the POST method.
URL: | http://domainname.crma.pro:81/onlineforms |
quide | form integration samples |
Params: |
action - get form value
form - ID of the form requested
host - if you are using AJAX, you should specify the name of the website, from where the sitename.com request is sent |
Response: |
{ |
Sending a filled form
URL: | http://domainname.crma.pro:81/onlineforms |
guide | form integration samples |
Params: |
action - fill form value
formtype - ID of form type
host - if you are using AJAX, you should specify the name of the website, from where the sitename.com request is sent
data - fields data
{ |
Response: |
{ |
Requesting all types of objects available
URL: | http://domainname.crma.pro:81/sharedapi/stock/types |
Params: | no |
Github | method: getStockTypes |
Response: |
[
|
Requesting all categories of objects available
URL: | http://domainname.crma.pro:81/sharedapi/stock/category |
Params: | no |
Github | method: getStockCategory |
Response: |
{
|
Obtaining the list and structure of fields for types of objects
URL: | http://domainname.crma.pro:81/sharedapi/stock/fields |
Github | method: getStockFields |
Params: | no |
Response: |
{
|
Search by various criteria in objects
URL: | http://domainname.crma.pro:81/sharedapi/stock/filter |
Github | method: getStockByFilter |
Params: |
type - ID of object type (obligatory field)
category - ID of object category
nested - values "true" and "false"; including enclosed categories
search - search bar (can contain object name or fields of type "text", "select", and "multiselect" (for full search))
byid - object ID
manager - supervisor ID
groups - array of CRM groups
fields - array of search conditions by fields
[{id:id properties,value: value},{...}]
restrictions can be set for fields of type "integer", "decimal", "price", "time", "date", and "datetime":
value: '>= value' - equal or above value: '<= value' - equal or below value: 'value_1 & value_2' - between 1 and 2 associated_with_customer - contact associated with object
order - "asc" - assortment in ascending order, "desc" - assortment in descending order
order_field - if "stock_activity_date" is specified as value, the selection will be assorted by activity date
date - {from: "2015-10-29 09:45:23", to: "2015-11-19 13:05:12"} selection for a certain period
date_field - if "stock_activity_date" is specified as value, the selection will be assorted by activity
page - page
publish - 1 - active, 0 - deleted, 1 by default
limit - number of entries in a selection: 20 by default, 500 max. |
Response: |
{
list - array of selected data
count - total of entries found |
Adding new objects to the CRM (this operation requires access to entries)
URL: | http://domainname.crma.pro:81/sharedapi/stock/insert |
Github | method: insertStock |
Params: |
//array of the entries to be added
You can find an example of files upload in section Utilities / Files upload |
Response: |
//response contains the array of added objects |
Editing CRM objects (this operation requires access to editing)
URL: | http://domainname.crma.pro:81/sharedapi/stock/update |
Github | method: updateStock |
Params: |
//editing entries is similar to adding entries: add object ID to the list of parameters |
Deleting CRM objects (this operation requires access to deletion)
URL: | http://domainname.crma.pro:81/sharedapi/stock/delete |
Github | method: deleteStock |
Params: |
// to delete objects, you need to send the array of their IDs
[10234,10432,10342,...] |
Obtaining the list of additional fields for user
URL: | http://domainname.crma.pro:81/sharedapi/worker/fields |
Github | method: getBindedSelectVariants |
Params: | no |
Response: |
[
Same as objects |
Obtaining the list of departments
URL: | http://domainname.crma.pro:81/sharedapi/worker/department |
Github | method: getDepartment |
Params: | no |
Response: |
[
id - department ID
parent_id - parent ID for enclosed departments
name - department name
description - description
order - order of assortment |
Obtaining the list of branches
URL: | http://domainname.crma.pro:81/sharedapi/worker/filiation |
Github | method: getFiliation |
Params: | no |
Response: |
{
id - department ID
name - name
description - description
address - address
phone - phone number
email - email address |
Searching users by various criteria
URL: | http://domainname.crma.pro:81/sharedapi/worker/filter |
Github | method: filterEmployee |
Params: |
group - CRM group ID
id - array of user IDs
division_id - array of department IDs
suboffice_id - array of branch IDs
surname - last name
name - first name
email - email address
phone - phone number
fields - array of conditions for additional properties (same as objects) |
Response: |
{
id - user ID
avatars - array of profile pictures of various sizes, including the original
type - possible values: "admin", "hr", "general manager", "simple"
division_id - department ID
suboffice_id - branch ID
post - position
boss - marked as department manager
name - first name
surname - last name
patronymic - patronymic
internalemail,externalemail - internal and external email
internalphone,externalphone,mobilephone - internal and external phones, and mobile phone
birthday - date of birth
address - address
about - description
hobby - hobby
created_on - registration date
gender - sex: male, female
fields - fields (same as objects)
asterisk_short_number - asterisk extension |
Obtaining the list of CRM groups available
URL: | http://domainname.crma.pro:81/sharedapi/managergroup |
Github | method: getAvailGroups |
Params: | no |
Response: |
[
id - CRM group ID
name - group name |
Obtaining fields from contact profile
URL: | http://domainname.crma.pro:81/sharedapi/purchaser/fields |
Github | method: getCustomerFields |
Params: | no |
Response: | See "Obtaining object fields" |
Search in contacts
URL: | http://domainname.crma.pro:81/sharedapi/purchaser/filter |
Github | method: filterCustomers |
Params: |
groups - array of CRM groups
manager - supervisor ID
byid - contact ID
marktype - array of type IDs
nattype - subtypes: "private_individual" - private individual, "legal_entity" - legal entity; both displayed by default
search - search bar (can contain first name, last name, email address, phone number)
fields - array of conditions for additional properties (same as objects)
order - "asc" - assortment in ascending order, "desc" - assortment in descending order
order_field - if "customer_activity_date" is specified as value, the selection will be assorted by activity date
date - {from: "2015-10-29", to: "2015-11-19"} selection for a certain time period
date_field - if "customer_activity_date" is specified as value, the selection will be assorted by activity
page - page
publish - 1 - active, 0 - deleted, 1 by default
limit - number of entries in selection (50 max.)
|
Response: |
{
list - array of selected data
count - total of entries found
|
Same as objects (Github method: insertCustomers)
Available fields:
source - one of the options: "online_consult", "manager_customer", "help_manager", "mobile"
name - first name
surname - last name
patronymic - patronymic
manager_id - supervisor ID
additional_manager_id - array of additional supervisor IDs
marktype - type
email - list of email addresses
phone - list of phone numbers
comment - comment
Obtaining the CRM elements associated to contact
URL: | http://domainname.crma.pro:81/sharedapi/purchaser/attach |
Github | method: getCustomerAttachments |
Params: |
ids - array of contact IDs or single value
|
Response: |
{
|
Obtaining the list of activity types
URL: | http://domainname.crma.pro:81/sharedapi/applications/types |
Github | method: getRequestTypes |
Params: | no |
Response: |
[
id - activity ID
name - name
service - marked as service
groups - list of groups with the access to this type
|
Obtaining the list of activity fields
URL: | http://domainname.crma.pro:81/sharedapi/applications/fields |
Github | method: getRequestFields |
Params: | no |
Response: | See "Obtaining object fields" |
Search in activities
URL: | http://domainname.crma.pro:81/sharedapi/applications/filter |
Github | method: filterRequests |
Params: |
search - search bar (can contain contact's last name or words from comments/activity name)
groups - array of CRM groups
manager - supervisor ID
byid - activity ID
customer - contact ID
types - array of type IDs
order - "asc" - assortment in ascending order, "desc" - assortment in descending order
order_field - if "request_activity_date" is specified as value, the selection will be assorted by activity date
date - {from: "2015-10-29", to: "2015-11-19"} selection for a certain time period
date_field - if "request_activity_date" is specified as value, the selection will be assorted by activity
statuses - array of status IDs
"unselected" - not specified
"mustbeprocessed" - requires processing
"processnow" - requires urgent processing
"processed" - processed
"postponed" - postponed
"malformed" - invalid
"cancelled" - cancelled
"reprocess" - requires improvement
page - page
publish - 1 - active, 0 - deleted, 1 by default
limit - number of entries in selection (50 max.)
|
Response: |
{
list - array of selected data
count - total of entries found
|
Same as objects (Github method: insertRequests)
Available fields:
source - one of the options: "online_consult", "none", "help_manager", "online_form"
customers_id - contact ID (obligatory field)
employee_id - supervisor ID
additional_employee_id - array of additional supervisor IDs
comment - comment
request_name - activity name
status - one of the options: "unselected", "mustbeprocessed", "processnow", "processed", "postponed", "malformed", "cancelled", "reprocess"
request_type - activity type ID (obligatory field)
Obtaining the list of deal types
URL: | http://domainname.crma.pro:81/sharedapi/sales/types |
Github | method: getSaleTypes |
Params: | no |
Response: |
[
id - deal type ID
name - name
stages - list of deal stages
|
Obtaining the list of fields for all types of deals
URL: | http://domainname.crma.pro:81/sharedapi/sales/fields |
Github | method: getSaleFields |
Params: | no |
Response: |
{
34 - deal type ID
stages - groups of fields for stages, (0 - ungrouped deal fields)
price_fields - fields containing deal value
fields - list of fields
nested_selects - enclosed properties of type "select" and "multiselect"
|
Obtaining the list of deals
URL: | http://domainname.crma.pro:81/sharedapi/sales/filter |
Github | method: filterSales |
Params: |
search - search bar
type - array of deal type IDs
stage - array of deal stage IDs
customer - contact ID
manager - supervisor ID
page - page
publish - 1 - active, 0 - deleted, 1 by default
limit - number of entries in selection (50 max.)
byid - obtaining deal and its ID
order - "asc" - assortment in ascending order, "desc" - assortment in descending order
order_field - if "sale_activity_date" is specified as value, the selection will be assorted by activity date
date - {from: "2015-10-29", to: "2015-11-19"} selection for a certain time period
date_field - if "sale_activity_date" is specified as value, the selection will be assorted by activity
|
Response: |
{
list - array of selected data
count - total of entries found
|
Obtaining additional data about deals associations with other CRM elements
URL: | http://domainname.crma.pro:81/sharedapi/sales/details |
Github | method: getSaleDetails |
Params: |
ids - array of deal IDs
|
Response: |
{
|
Request: selection of invoices on each page with search and filter applied
URL: | http://domainname.crma.pro:81/sharedapi/accounts/get |
Github | method: billsGet |
Params: |
type - type of invoice: in/out
date_start - invoice created on this date or later (format: dd.mm.yyyy / yyyy-mm-dd)
date_start - invoice created on this date or earlier (format: dd.mm.yyyy / yyyy-mm-dd)
active - active / inactive invoices (1,0)
pay_status - payment status: "not", "part", "full"
client_id - contact ID
search - search bar: search by invoice number, contact's last name, company name
company_id - ID of contact's payment details
sale_id - ID of associated deal
not_sale_id - selection of entries not associated with the deal specified: if "sale_id" and "not_sale_id" are both specified in the filter, "not_sale_id" is ignored
ids - selection of entries from the array / line (divided by ",") of invoice IDs, with filter applied; filter cleared by default
orderType - "asc" - assortment in ascending order, "desc" - assortment in descending order
order - assortment field ("b.id" - invoice ID, "b.date_create" - invoice creation date)
limit - the number of results on one page: 1000 by default
page - output page number
|
Filter by default: |
{
|
Response: |
{
filter - array of filter parameters
limit - number of results
page - results page
total - total of entries matching the filter
list - array of entries
author - creator ID
author_name - creator name
bill_active - post status
client_company_id - ID of contact's payment details
client_id - contact ID
date_create - creation date; format: yyyy-mm-dd
hash - unique hash for printing templates
id - invoice ID
my_company_id - ID of company's payment details
outer_id - external key
pay - invoice paid
pay_status - payment status: "not" - unpaid, "part" - partially paid, "full" - fully paid
payer - payer name
payment_date - payment date
recipient - beneficiary name
sale_id - associated object ID
stockgroup_id - ID of objects list
summ - amount
type - type: "out" - outbound / "in" - incoming
|
Obtaining full information about invoices, using the list of invoice IDs
URL: | http://domainname.crma.pro:81/sharedapi/accounts/get_full |
Github | method: billsGetFull |
Params: |
ids - array of invoice IDs
|
Response: |
{
bill_active - post status
client - array of contact info
id - unique CRM number
logo - user logo
name - first name
patronymic - last name
surname - patronymic
client_company - contact's payment details
bank_name - name of the bank
bank_city - city of the bank
email - email address
id - unique CRM number
legal_address - legal address
mail_address - postal address
name - name
phone - phone number
city - city
type - type
date_create - creation date
hash - unique hash for printing templates
id - unique CRM number
my_company - array of associated company's payment details (fields coincide with those of contact's payment details)
outer_id - unique external (synchronizing) reference
pay - paid
pay_status - payment status
payer - array of payer links
payment_date - date of payment
products - array of objects
recipient - array of beneficiary links
sale_id - unique CRM reference of associated deal
stockgroup_id - objects list reference
summ - invoice amount
to_pay - for payment (VAT included)
type - type of invoice
|
API for adding invoices. Invoices for addition should be submitted to the CRM in an array. The maximum number of invoices submitted at a time is 1000.
The response is also rendered in an array, with a result about each invoice, including error key and description, in case the addition failed.
URL: | http://domainname.crma.pro:81/sharedapi/accounts/add |
Github | method: billsAdd |
Params: |
[
{
date_create - creation date
product - array of objects
count - object quantity
name - object name
price - object price
sale_id - ID of associated deal
stockgroup_id - ID of objects list
client_company_id - ID of contact's payment details
client_id - contact ID
my_company_id - ID of company payment details
nds - VAT
type - type: "out" - outbound / "in" - incoming
}
]
|
Response: |
[
stat - result: 1 - successful, 0 - error
id - unique invoice number
error - array of errors
key - error key
mes - description of error
|
API for updating invoices. Invoices for editing should be submitted to the CRM in an array. The maximum number of invoices submitted at a time is 1000.
The response is also rendered in an array, with a result about each invoice, including error key and description, in case the update failed.
URL: | http://domainname.crma.pro:81/sharedapi/accounts/add |
Github | method: billsUpdate |
Params: |
[
{
bill_id - unique invoice number
product - array of objects
count - object quantity
name - object name
price - object price
sale_id - ID of associated deal
stockgroup_id - ID of objects list
client_company_id - ID of contact's payment details
client_id - contact ID
my_company_id - ID of company payment details
nds - VAT
type - type: "out" - outbound / "in" - incoming
}
]
|
Response: | See "Adding invoices" |
API for editing invoice parameters
URL: | http://domainname.crma.pro:81/sharedapi/accounts/edit |
Github | метод: billsEdit |
Params: |
{
bill_id - unique invoice number
date_create - creation date; format: yyyy-mm-dd / dd-mm-yyyy
product - array of objects
count - object quantity
name - object name
price - object price
sale_id - ID of associated deal
outer_id - external ID
client_company_id - ID of contact's payment details
client_id - contact ID
my_company_id - ID of company payment details
nds - VAT
is_cash - payment by cash
type - type: "out" - outbound / "in" - incoming
}
|
Response: |
stat:0,
stat - result: 1 - successful, 0 - error
error - array of errors
key - error key
mes - description of error
|
API for setting invoice payment status to "Partially paid" or "Fully paid".
The response is rendered in an array with the following parameters: "stat", "status_pay", or "error" — in case of error.
URL: | http://domainname.crma.pro:81/sharedapi/accounts/set_pay |
Github | method: billsSetPay |
Params: |
{
id - unique payment number
pay - payment amount (complementary)
}
|
Response: |
{
stat - result: 1 - successful, 0 - error
status_pay - current status
error - array of errors
key - error key
mes - description of error
|
API for uploading files
URL: | http://domainname.crma.pro:81/sharedapi/utils/upload |
Github | method: uploadFile |
Params: |
object - one of the possible values: "stock", "applications", "purchaser"
upload - name of the file uploaded: multiple uploads are possible
|
Response: |
{
|
For comments, use the following request
URL: |
http://domainname.crma.pro:81/sharedapi/[object_type]/comments Possible values for object type: "stock", "applications", "purchaser", "sales" |
Github | method: get |
Params: |
entity_id - ID or array of IDs
|
Response: |
All comments to the objects, activities, and deals associated with a contact are displayed for it
{
|
Go to page "SMS sending parameters" and click "Add provider" of "API integration" type and with the following fields:
- API key: | an entry of 32 characters generated by APRO CRM server — indispensable for requests |
- Contact gateway: | URL of the script getting requests from APRO CRM |
- APRO CRM gateway: | URL of the script for sending requests to contacts |
Add sender name/phone number, specifying the provider you just created. APRO CRM can only receive SMS messages sent to the phone numbers added in the administration panel.
sendSms | send SMS |
smsStatus | get current SMS sending/delivery status |
smsReceived | get new message |
Requests are sent to the relevant URLs by the POST method, and responses are rendered in JSON format.
The obligatory parameters of request are "action" and "hash".
Request hash is calculated as follows:
Request hash is calculated as follows:
- 1. key-value matches are assorted by the key name;
- 2. values are merged in one entry;
- 3. an ARI key is added to the entry;
- 4. hash constitutes value MD5 from the entry.
sendSms request
Parameters: |
action = sendSms sender = sender_name destination = destination_number message = sms_text |
Response |
If an SMS was queued for sending correctly, the response will comprise the following fields:
{
|
In case of error:
{
|
smsStatus request
Parameters: |
action = smsStatus sms_id = sms_numeric_reference |
Response |
In case of success:
{
|
In case of error:
{
In this case, APRO CRM server will repeat the request later.
|
new | queued for sending |
inprogress | being sent |
send | sent |
delivered | delivered |
notdelivered | not delivered |
blocked | sending impossible |
absent | subscriber unavailable |
notfound | SMS with this ID not found |
smsReceived request
Parameters: |
action = smsReceived sms_id = sms_numeric_reference (> 0) sender = sender_number destination = destination_number message = sms_text count = number_of_sms_messages date = date_received_in_unix_timestamp (non-obligatory parameter) |
Response |
If an SMS was added in APRO CRM correctly, the response will be as follows:
{
|
If the server cannot process the request, and the request should be repeated later, the response will be as follows:
{
|
|
In case of error, when there is no need to repeat the request, the response will be as follows:
{
|
To start working with telephony, go to page "Settings" — "Integrations" — "API v 2" and create an API key with a permission for "Calls". All the subsequent requests must contain this key.
Requests are sent to: http://domainname.crma.pro:81/sharedapi/calls/[request_name], where domainname is replaced by your domain name in the CRM.
Sample request:
Requests are sent to: http://domainname.crma.pro:81/sharedapi/calls/[request_name], where domainname is replaced by your domain name in the CRM.
Sample request:
{
apikey: /* key of 32 characters */,
params: /* associative array of parameters */
}
Response is available in JSON format.
trunks | obtain the list of connections |
phoneNumbers | obtain the list of phone numbers for incoming and outbound calls |
statuses | obtain the list of call statuses available (only statuses set manually by users) |
history | obtain calls history |
update | edit call |
import | import one call into the history |
importall | import several calls into the history by one request |
call | create call |
trunks request
Parameters: | no |
Response |
List of all CRM connections:
{
|
In case of error:
{
|
phoneNumbers request
Parameters | no |
Response |
List of all phone numbers for incoming and outbound calls in the CRM:
{
|
In case of error:
{
|
statuses request
Parameters | no |
Response |
List of all statuses that can be set to calls:
{
|
In case of error:
{
|
history request
Parameters |
fromPhone filter by caller phone number toPhone filter by destination phone number dateFrom search calls after date dateTo search calls before date type type of call: "in", "out" limit response limit in the number of entries (1000 max.) page defines the results page together with the limit orderField assort by field (date field by default) orderType order of assortment: "ASC", "DESC" (by default "DESC") |
Response |
List of calls in the history, considering the filters:
{
|
In case of error:
{
|
import, update, and importall requests
These request types use the general parameters of call. Some parameters are only available when creating a call, and cannot be modified or edited later.
Parameters available only when creating/adding call:
Parameters available when updating call:
The fields from the lists above are submitted to the "import" and "update" requests in the associative array "params".
Array "params[calls][]" is submitted to array "importall" together with the calls to be imported.
Parameters available only when creating/adding call:
uniqueId | unique call reference: an entry of 32 characters |
from | phone number, from which the call was issued |
to | phone number, to which the call was issued |
trunkId | ID of connection, through which the call was made |
callerId | caller ID (same as caller phone number, as a rule) |
timestamp | time of call — preferably in Unix Timestamp or MYSQL with GMT shift |
isIncoming | call direction in relation to the CRM: "true" or "1" - incoming, other - outbound |
url | URL of call recording: the call will be downloaded or saved in the CRM |
callDuration | call duration in seconds |
isAnswered | whether the call was answered |
customStatus | ID of the status set for call |
Parameters available when updating call:
uniqueId | unique reference of the call to be updated |
url | URL of call recording: the call will be downloaded or saved in the CRM |
callDuration | call duration in seconds |
isAnswered | whether the call was answered |
customStatus | ID of the status set for call |
Array "params[calls][]" is submitted to array "importall" together with the calls to be imported.
Response |
{
|
In case of error:
{
|
call — request from the CRM to create a call
You can create a virtual connection in telephony settings, and assign an outbound phone number and a user for it. The CRM will send the "call" to the URL you specified each time a user makes a call through this virtual connection.
Parameters: |
action = call phone_to which phone number to call phone_from which phone number to use for the call user_id user ID in the CRM key key specified when creating connection |
Response |
Server response in JSON format:
{
|
In case of error:
{
|
All API requests associated with external conversations have the "[object_type] = externaldialogs" parameter.
Request is multifunctional and is conditioned on the set of parameters.
[subtype] | insert |
URL: | http://domainname.crma.pro:81/sharedapi/externaldialogs/insert |
Params: |
customer - contact ID in APRO CRM
Optional, if the conversation needs to be associated with a contact.
If you need to create a conversation without associating it to contact, just specify "0" in parameter "customer".
dialog - set of properties of conversation type
id - requisite ID of conversation type
Optional: if this parameter is specified, other parameters in the "group" are ignored.
name - name of the new type of conversation
When creating a new conversation.
employees - list of conversation participants
List of user IDs.
|
Response |
In any case, the response will contain a "clientkey":
{
Attention!Save the "clientkey" for further usage:
{
|
Request for changing conversation type ("Name", "Users").
[subtype] | update |
URL: | http://domainname.crma.pro:81/sharedapi/externaldialogs/update |
Params: |
id - ID of conversation type (obligatory)
name - new name of conversation type (optional)
Specify the new name, if it needs to be changed.
employees - new list of participants (optional)
List of user (participant) IDs, if they need to be changed.
|
Response |
status - boolean: operation completion status
{
|
Request for listing of conversation types by pages.
[subtype] | groupslist |
URL: | http://domainname.crma.pro:81/sharedapi/externaldialogs/dialogtypeslist |
Params: |
page - number of the page requested (0 - first page)
If this parameter is absent, the first page will be rendered.
count - number of entries on page (30 by default)
Integer between 10 and 50 (inclusive).
|
Response |
list - array of conversation types
{
|
Request for listing the history of messages by pages.
[subtype] | history |
URL: | http://domainname.crma.pro:81/sharedapi/externaldialogs/history |
Params: |
group - ID of conversation type (obligatory)
client - client key (obligatory)
date - timestamp (obligatory)
Deadline - all messages before the deadline specified are rendered.
page - number of the page requested (0 - first page)
If this parameter is absent, the first page will be rendered.
The history is rendered starting from the latest message.
count - number of entries on page (30 by default)
Integer between 10 and 50 (inclusive).
|
Response |
list - array of conversation types
{
|
Request for the listing of unread messages.
[subtype] | notread |
URL: | http://domainname.crma.pro:81/sharedapi/externaldialogs/notread |
Params: |
groups - list of IDs of conversation types (obligatory)
client - client key (obligatory)
|
Response |
list - array of conversation types
{
|
All API requests associated with organizer have the "[object_type] = org_events" parameter.
Request for the listing of events by pages
[subtype] | list |
URL: | http://domainname.crma.pro:81/sharedapi/org_events/list |
Params: |
filters - filters
publ - show deleted (1 - not deleted, 0 - deleted , all - all)
page - number of the page requested (0 - first page)
If this parameter is absent, the first page will be rendered.
count - number of entries on page (50 by default)
Integer between 10 and 50 (inclusive).
|
Response |
list - array of events
total - the total of events matching the specified filters
{
|
Info about event
[subtype] | get |
URL: | http://domainname.crma.pro:81/sharedapi/org_events/get |
Params: |
id - reminder ID
|
Response |
event - event data (same as when creating event)
users - array with the info about event participants
key - user ID
values: "simple" - regular, "root" - moderator (initiator)
|
Adding a new event in the organizer
Don't forget to activate the following parameters in the API settings of the key.
Don't forget to activate the following parameters in the API settings of the key.
[subtype] | insert |
URL: | http://domainname.crma.pro:81/sharedapi/org_events/insert |
Params: |
event - array with the info about event
title - event name (obligatory)
date - event date in any conventional format with time zone shift indication (in case time zone shift is not specified, the GMT time zone will be set by default): obligatory.
The time indication will be rounded out to a multiple of 5 minutes, for instance:
18:01 will be modified to 18:00 18:03 will be modified to 18:05 For example:
PHP - date("from"); «2017-04-27T10:49:48+04:00»
Javascript - new Date().toString(); «Thu Apr 27 2017 10:49:48 GMT+0400»
description - event description
allDay - whole day event ("1" - yes, "0" - no)
duration - event duration in minutes (multiple to 5 minutes)
remind_active - notification activated ("yes" - yes , "no" - no)
remind_before - timelapse before the event for showing the notification (multiple to 5 minutes)
textColor - style arrangement (text color)
backgroundColor - style arrangement (background color)
borderColor - style arrangement (frame color)
users - array with the info about event participants
key - user ID
values: "simple" - regular , "root" - moderator (initiator)
|
Response |
event - event info
{
|
Editing events in the organizer
Don't forget to activate the following parameters in the API settings of the key.
Don't forget to activate the following parameters in the API settings of the key.
[subtype] | update |
URL: | http://domainname.crma.pro:81/sharedapi/org_events/update |
Params: |
Parameters are mostly the same as those for adding, with a few following exceptions:
- add ID - ID of the event edited to array "event"
- you can get only those parameters that need to be edited
- you can skip parameter "users", if the list of participants does not change
- you can specify parameter"publ" = "0" for deletion, "1" - for recovery (requires the relevant access permission)
users - array with the info about event participants
key - user ID
values: "simple" - regular, "root" - moderator (initiator)
|
Response |
event - info about event (same as when creating event)
|
Deleting events in the organizer
Don't forget to activate the following parameters in the API settings of the key.
Don't forget to activate the following parameters in the API settings of the key.
[subtype] | delete |
URL: | http://domainname.crma.pro:81/sharedapi/org_events/delete |
Params: |
id - reminder ID
|
Response |
event - info about event (same as when creating event)
|
In order to enable Webhook, you need to have business processes activated.
After setting the URL and selecting the events you want to subscribe to, a "post" request containing the parameters of the CRM event is sent to the url in real time mode.
After setting the URL and selecting the events you want to subscribe to, a "post" request containing the parameters of the CRM event is sent to the url in real time mode.
The body of the post request contains an array of data in JSON format. The general outlook of the array is as follows:
{
"subject_type" : "employee",
"subject_type_id" : "2",
"event" : "create",
"object_typ" : "customer",
"object_sub_type" : "0",
"object_sub_id" : "10443",
"snapshot" : [],
"merge" : []
}
You can find a sample script for Webhook processing in PHP samples on Github (example/webhook.php)
subject_type - event initiator
subject_type_id - event initiator ID
event - event type
object_type - object involved in the event
object_sub_type - subtype of the object involved
object_sub_id - event object ID
snapshot - array of current object properties
merge - array of changes in object properties
When object properties are changed, the former property values are rendered in this array. Array format:
{
"name" : {
"type" : "edit",
"value" : "John",
},
1207 : {
"type" : "edit",
"value" : "100000",
}
}
Array key is a variable field. If the key is an entry - it becomes a basic field, if the key is a number - it becomes an additional field.
- business - business process
- system - system
- employee - user
- login - system entry
- view - viewing
- create - creating
- edit - editing
- delete - deleting
- export - data export
- import - data import
- status - change of status/stage
- stage - change of status/stage
- comment - new comment
- manager - change of supervisor
- answer - response to reminder question
- messenger - new message
- queue - assortment
- other - other
- customer - contacts
- request - activities
- stock - objects
- sale - deals
- task - tasks
- messenger - messages (individual, group)
- remind - reminders
- email - email
- emailsystem - email
- call - call
- sms - SMS
- delivery - campaign
- comment - comment
- blank - document
- app - attachment
"Snapshot" array comprises:
{
//object ID
"id" : "10443",
//initiator ID
"author" : "2",
//ID of CRM group
"group_id" : "0",
//first name
"name" : "Michael",
//last name
"surname" : "Wildes",
//patronymic
"patronymic" : "",
//supervisor
"manager_id" : "2",
//list of email addresses
email: [
{
mail: "customer@gmail.com",
comment: ""
}
],
//list of phone numbers
phone: [
{
phone: "1965 XXX 4332",
comment: "Main"
},
{
phone: "1423 XXX 2253",
comment: "Second"
}
],
//creation date
"create_date" : "2017-04-06 11:27:36",
//comment
"comment" : "",
//active
"publish" : "1",
//contact type
"marktype" : "0",
//private individual / legal entity
"nattype" : "private_individual",
//fields
"extproperty" : [
1246 : {
"id" : "1246",
"type" : "text",
"value" : ""
}
]
}
"Snapshot" array comprises:
{
//activity ID
"request_id" : "455",
//activity date
"request_date" : "2017-03-27 16:56:33",
//comment
"request_comment" : "",
//supervisor ID
"manager" : "2",
//contact
"customer" : "10431",
//email address
"email" : [
{
"mail" : "test@test.com",
"comment" : ""
}
]
//activity status
"status" : "unselected",
//type of activity
"request_type" : "8",
//activity
"publish" : "1",
//initiator
"employee_creator_id" : "2",
//list of additional supervisors
"shared_managers" : []
//fields
"extproperty" : [
1246 : {
"id" : "1246",
"type" : "text",
"value" : ""
}
]
}
"Snapshot" array comprises:
{
//object ID
"id" : "536927",
//ID of CRM group
"group_id" : "0",
//ID of objects category
"parent" : "19",
//name of objects category
"parentname" : "Sale",
//name
"name" : "commercial sale: 23, Phoenix St.
//quantity
"count" : "1",
//creation date
"date_add" : "2017-04-05 16:00:29",
//active
"publish" : "1",
//copy / associated with group of objects
"copy" : "0",
//type of object
"type" : "2",
//name of object type
"typename" : "Commercial property",
//type of last event involving the object
"stock_activity_type" : "edit",
//date of last event involving the object
"stock_activity_date" : "2017-04-05 16:19:54",
//object associated to contact
"associated_with_customer" : "",
//initiator
"stock_creator_id" : "0
//list of additional supervisors
"shared_managers" : []
//fields
"extproperty" : [
1246 : {
"id" : "1246",
"type" : "text",
"value" : ""
}
]
}
"Snapshot" array comprises:
{
//deal ID
"id" : "160",
//contact ID
"customers_id" : "10444",
//supervisor ID
"employee_id" : "2",
//date of deal
"date_create" : "2017-04-06 15:24:57",
//deal type ID
"sales_type_id" : "4",
//deal type name
"sales_type_name" : "Matching for sale and assisting on sale",
//deal status
"sales_status_id" : "14",
//name of deal status
"sales_status_name" : "Preliminary agreement",
//comment
"comment" : "",
//price
"price" : "",
//activated / deleted
"publish" : "1",
//contact's first name
"customer_name" : "Retail sales",
//contact's last name
"customer_surname" : "",
//contact's patronymic
"customer_patronymic" : "",
//contact's email address
"customer_email" : "",
//type of latest event involving the deal
"sale_activity_type" : "create",
//date of latest event involving the deal
"sale_activity_date" : "0000-00-00 00:00:00",
//deal initiator
"sale_creator_id" : "2"
//list of additional supervisors
"shared_managers" : []
//fields
"extproperty" : [
1246 : {
"id" : "1246",
"type" : "text",
"value" : ""
}
]
}
"Snapshot" array comprises:
{
//ID of email to contact
"id" : "17",
//campaign ID
"delivery_id" : "10",
//ID of subscribers group
"group_id" : "1",
//SMTP account ID
"smtp_id" : "1",
//contact
"customer_id" : "0",
//recipient email
"email" : "test@test.com",
//recipient reference
"url" : "54f12091099d5c5c4cd9b055504df2c9",
//email status
"status" : "open",
//date of latest change
"date_change" : "2017-04-06 15:57:12",
//log of changes
"log" : {,
//status
"res" : "1",
"stat" : "1",
//description of error
"error" : "",
//date
"date_send" : "2017-04-06 03:51:52",
//list of dates when email was opened
"check" : [
"2017-04-06 16:01:34"
]",
]
//ID of email to contact
"letter_id" : "17
}
"Snapshot" array comprises:
{
"id" : "33902",
"date_time" : "2017-04-06 12:42:20",
"apro_crm_user" : "79",
"parent_type" : "direct_call",
"parent_id" : "79",
"call_to_type" : "crm_client",
"call_to_id" : "60046",
"call_id" : "4837780ff331a99d3ff76e5f7abd55cd",
"scenario_id" : "0",
"call_duration" : "0",
"call_cost" : "0.00000",
"trunk_id" : "7",
"caller_id" : "74952255024",
"from_number" : "108",
"to_number" : "79379840000",
"vox_login" : "login",
"url" : "http://test.com",
"path" : "",
"is_downloaded" : "0",
"answered" : "-1",
"voicemessage" : "0",
"fax" : "0",
"fax_status" : "0",
"custom_status" : "0",
"payload" : "",
"api_incoming" : "0",
"is_cached" : "0",
"record_download" : "",
"record_play" : ""
}
"Snapshot" array for creation and viewing comprises:
{
"id" : "2536",
"type" : "standard",
"autor_id" : "2",
"autor_type" : "user",
"created_on" : "2017-04-07 09:53:00",
"edited_at" : "2017-04-07 10:11:17",
"terms" : "2017-04-30 00:00:00",
"title" : "Task title",
"description" : "Call your clients about their birthday",
"status" : "new",
"priority" : "2",
"sms" : "0",
"room" : "",
"external" : "0",
"last_change" : "edit",
"changer_id" : "2",
"changer_type" : "user",
"change_date" : "2017-04-07 10:11:17",
"description_rev" : "3",
"parent_task_id" : "0",
"terms_pset" : "0",
"files" : [
{
"id" : "8790",
"type" : "task",
"title" : "Text of congratulation.txt"
}
],
"users" : [
{
"id" : "2",
"type" : "director",
"name" : "admin",
"surname" : "admin",
"patronymic" : "admin"
},
{
"id" : "6",
"type" : "co-executive",
"name" : "David",
"surname" : "Mills",
"patronymic" : "",
},
{
"id" : "8",
"type" : "executive",
"name" : "Alexandra",
"surname" : "Rhodes",
"patronymic" : "",
}
],
"history" : [
{
"task_id" : "2536",
"change_type" : "edit",
"change_arg0" : "3",
"status_from" : "new",
"status_to" : "new",
"date" : "2017-04-07 10:11:17",
"prev_terms" : "0000-00-00 00:00:00",
"changer_id" : "2",
"changer_type" : "employee"
}
"],
"tags" : {
"existTags" : []
"taskTags" : []
}
}
"Snapshot" array for changing status comprises:
{
"action" : "change_status",
"data" : {
"task_id" : "2536",
"changer_type" : "employee",
"changer_id" : "2",
"status_from" : "new",
"status_to" : "frozen"
}
}
"Snapshot" array for creation and viewing comprises:
{
// template ID
"blank" : "74",
// title
"title" : "",
"filledtype" : "shared",
// document fields
"extfields" : [
{
"ext" : "1195",
"data" : "text",
"value" : "533 Pritchard Court",
}
// document text
"fish" : "Document filled",
"object_type" : "customer",
"object_id" : "0",
// template reference
"hash" : "493b333b7d21f1ba344c3508bfa0edc9",
// document ID
"id" : "115"
}