Credentials
In order to leverage the functionality provided by the API, you will need credentials: a CRM ID and a CRM API key. Both of these need to be included in every message to the CRM, where they will be validated before performing any operations. If either one is incorrect, or not included, the operation will be aborted and a 401 response will be returned.
API credentials are only extended to official partners of Econtract. To become a partner and receive and these credentials, please get in touch with the organisation management.
Installation
PHP integration
Econtract has developed a PHP package that will allow you to easily integrate with the Econtract CRM application. This package is stored on Github and can be included in your project using composer.
{
"require": {
"econtract/crm": "3.*"
}
}
Or install it via the commandline:
composer require econtract/crm
Next, you will need to create a configuration file named .env
and add the following values to it:
AB_CRM_URL=http://foo.com/bar // URL to the Aanbieders CRM system
AB_CRM_ID=your_crm_api_id // Your unique CRM API ID
AB_CRM_KEY=your_crm_api_key // Your unique CRM API key
Finally, you will need to load the configuration file in before creating a new instance of the CrmService
class which you can use to create the actual PHP calls. Please note that this file is loaded automatically in some PHP frameworks (e.g. Laravel 5), so it may not be necessary to do this yourself.
include('vendor/autoload.php');
use Econtract/Crm/CrmService;
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
$crmService = new CrmService();
$contract = $crmService->getContract( 63 );
Laravel integration
If you are using Laravel, you can leverage the CrmServiceProvider class that is included in the CRM package. Add the service provider to your config/app.php
file:
'providers' => array(
//...
\Econtract\Crm\CrmServiceProvider::class,
)
Additionally, there is also a facade which makes it easy and intuitive to call the various method that the package provides. This alias also must be included your config/app.php
file:
'facades' => array(
//...
'Crm' => \Econtract\Crm\Facades\Crm::class,
),
Once this is done, you can easily call the methods using the facade:
$contract = Crm::getContract( 666 );
Integrations with other platforms
For all other platforms, integration with the CRM is also possible, though Econtract does not provide additional resources such as libraries or packages. In order to send or receive information from the CRM, simply submit a cURL request of the correct type (GET or POST) with the required data to the URL that matches your requirements. Be sure to always include your personal CRM API ID and API key in every request to ensure that the request will be processed correctly.
Usage
Get client
Resource | HTTP format | URL format | Description |
---|---|---|---|
Client | GET | /api/clients/{id} | Retrieve a client from the CRM |
Parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
ID | id | yes | integer | ID of the client in the CRM |
After sending the request, the CRM will send a detailed response with all information of the model.
Examples
// PHP using the econtract/crm package
$client = Crm::getClient( 666 );
Create client
Resource | HTTP format | Method | Description |
---|---|---|---|
Client | POST | /api/clients | Create a new client in the CRM |
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
Gender | gender | yes | integer | Gender (*) |
Market segment | segment | yes | integer | Market segment (*) |
First name | first_name | yes | string | First name |
Last name | last_name | yes | string | last name |
Birth date | birthdate | no | date | Birth date (YYYY-MM-DD) |
Birth place | birthplace | no | string | Birth place |
Nationality | nationality | no | string | Nationality (be, nl,...) |
ID card number | idnr | no | string | ID card number |
National registry number | rrnr | no | string | National registry number |
Cellphone | cellphone | yes | string | Cellphone (04xxxxxxxx) |
Landline | landline | yes | string | Landline (0xxxxxxxx) |
Fax | fax | no | string | Fax (0xxxxxxxx) |
yes | string | |||
Language | language | yes | string | Language (nl, fr) |
Company name | company | no | string | Company name |
Vat number | vat | no | string | Vat number (BExxxx.xxx.xxx) |
Iban | iban | no | string | IBAN nr (BExx xxxx xxxx xxxx) |
Bic | bic | no | string | BIC nr |
Family size | family_size | no | integer | Family size |
(*) Check the CRM parameters page for additional information on which values are accepted for this field
There is no need to check for duplication, as the CRM will do this for you. If a value does not apply for a particular customer (e.g. no vat number), the value can be ignored. After sending the request, the CRM will send a detailed response with all information of the recently created model.
Examples
// PHP using the econtract/crm package
$client = Crm::createClient(
array(
'gender' => 1,
'segment' => 1,
'first_name' => 'John',
'last_name' => 'Doe',
'birthdate' => '1956-12-25',
'birthplace' => 'Hasselt',
'nationality' => 'BE',
'idnr' => 5,
'rrnr' => 6,
'cellphone' => '012457898',
'landline' => '',
'fax' => '',
'email' => 'john.doe@server.com',
'language' => 'nl',
'bban' => '',
'iban' => '',
'bic' => '',
'family_size' => 3,
)
);
Get address
Resource | HTTP format | Method | Description |
---|---|---|---|
Address | GET | /api/addresses/{id} | Retrieve an address from the CRM |
Parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
ID | id | yes | integer | ID of the client in the CRM |
After sending the request, the CRM will send a detailed response with all information of the model.
Examples
// PHP using the econtract/crm package
$address = Crm::getAddress( 666 );
Create address
Resource | HTTP format | Method | Description |
---|---|---|---|
Address | POST | /api/addresses | Create a new address in the CRM |
Parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
Client ID | client_id | yes | integer | ID of the client to whom the address belongs |
Street | street | yes | string | Street |
House number | nr | yes | integer | House number |
Box | box | yes | string | Box |
Floor | floor | no | string | Floor on which the apartment is located |
Zip code | postal_code | yes | string | Zip code |
City | city | yes | string | City |
Country | country | yes | string | Country (BE, NL, ...) |
Building type | building_type | no | enum | Type of building for the given address (*) |
(*) Check the CRM parameters page for additional information on which values are accepted for this field
There is no need to check for duplication, as the CRM will do this for you. After sending the request, the CRM will send a detailed response with all information of the recently created model.
Examples
// PHP using the econtract/crm package
$address = Crm::createAddress(
array(
'client_id' => 666,
'street' => 'SomeStreet',
'nr' => 10,
'box' => '',
'postal_code' => 1234,
'city' => 'SomeCity',
'country' => 'BE',
'floor' => 4,
'building_type' => 3,
)
);
Get contract
Resource | HTTP format | Method | Description |
---|---|---|---|
Contract | GET | /api/contracts/{id} | Retrieve an contract from the CRM |
Parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
ID | id | yes | integer | ID of the contract in the CRM |
After sending the request, the CRM will send a detailed response with all information of the model.
Examples
// PHP using the econtract/crm package
$contract = Crm::getContract( 666 );
Create order
Resource | HTTP format | Method | Description |
---|---|---|---|
Order | POST | /api/orders | Create a new order in the CRM |
To create a new order in the CRM, you will have to provide all information required for the creation of the order along with the request. This includes all data related to the order, as well as all data pertaining to the client, the address and (optionally) the invoice_address for the contract. All data must be added in a single array and sent to the econtract CRM system. In order to prevent parameter collision, these data sets must prefixed with the client_
, address_
, and invoice_address_
strings, respectively. The CRM will make sure that no duplicate clients, addresses and orders will be created. If a client, address or order exists, the CRM will perform an update instead of creating a new one.
Aside from these general data entries, you will also need to send additional information depending on the product type of the order you are creating. These values should be added to the same array as the information above and sent as a whole to the CRM. The CRM will take care of filtering the data and assigning it to the correct models in the database. All parameters and their acceptable values are listed in the tables below.
After sending the request, the CRM will send a detailed response with all information of the recently created model.
Order parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
Product type | product_type | yes | enum | Product type of the order that is being created |
Comparison ID | comparison_id | yes | integer | ID of the comparison that was used to generate the order |
Affiliate ID | affiliate_id | yes | integer | ID of the affiliate through which the order was placed |
Sales channel ID | sales_channel_id | yes | integer | ID of the sales channel through which the order was placed |
IP address | ip_address | yes | integer | IP address of the client for the order is created |
Cookie ID | cookie_id | no | string | Can be found in the JSON response that you receive when creating the comparison |
Customer remarks | remarks | no | string | Remarks given by the customer while placing the order |
Internal remarks | internal_remarks | no | string | Internal remarks given by the agent while placing the order (not visible to the customer) |
Supplier ID | supplier_id | yes | integer | ID of the selected supplier |
Product ID | product_id | yes | integer | ID of the selected product |
Payment method | payment_method | yes | enum | Payment that is to be used for this contract (*) |
(*) Check the CRM parameters page for additional information on which values are accepted for this field
Electricity contract parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
EAN code | ean | yes | string | EAN code for day and day-night meters |
Exclusive night EAN code | ean_excl | no | string | EAN code for exclusive night meters |
Meter type | mru_type | yes | enum | Meter type (*) |
Meter number | mru_nr | yes | integer | Meter number of the electricity meter |
Connection type | connection_type | yes | enum | Connection type of the meter (*) |
Usage day | usage_day | yes | integer | Usage day in kWh |
Usage_night | usage_night | yes | integer | Usage night in kWh |
Usage exclusive night | usage_excl | yes | integer | Usage exclusive night in kWh |
Has budget meter | has_budget_meter | yes | boolean | Indicates whether or not the client has a budget meter |
Has_solar_panels | has_solar_panels | yes | boolean | Indicates whether or not the client has solar panels |
Solar inverter capacity | solar_inverter_capacity | no | double | Capacity of the solar inverter in kVa |
Solar installation year | solar_installation_year | no | enum | Year in which the solar panels for the client were installed (*) |
Has digital meter | has_digital_meter | no | boolean | Indicates whether or not the client has a digital meter |
Solar calculation type | solar_calculation_type | no | enum | Method with which the solar contribution is calculated (*) |
Solar injection day | solar_injection_day | no | integer | Solar injection on the day meter in kWh |
Solar injection night | solar_injection_night | no | integer | Solar injection on the night meter in kWh |
Monthly due amount | monthly_amount | no | double | Monthly deposit to be paid to the supplier |
Situation | situation | yes | enum | Situation for which the contract is being created (*) |
Wish date | wishdate | no | date | Preferred date on which the new contract should go into effect |
Current supplier | donor | yes | string | Id of the current supplier |
Client number at current supplier | donor_client_nr | yes | integer | Customer number at current supplier |
Index of day meter | index_day | no | integer | Index of the day meter |
Index of night meter | index_night | no | integer | Index of the night meter |
Index of exclusive night meter | index_excl | no | integer | Index of the exclusive night meter |
Is EAN unknown | ean_unknown | no | boolean | Indicates whether or not the client knows his EAN code |
Tariff card URL | tariff_card | no | string | URL to the tariff card of the product (filled automatically) |
(*) Check the CRM parameters page for additional information on which values are accepted for this field
Gas contract parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
EAN code | ean | yes | string | EAN code for gas meter |
Meter number | mru_nr | yes | integer | Meter number of the gas meter |
Usage | usage_gas | no | integer | Usage in kWh |
Situation | situation | yes | enum | Situation for which the contract is being created (*) |
Current supplier | donor | yes | string | Id of the current supplier |
Client number at current supplier | donor_client_nr | yes | integer | Customer number at current supplier |
Index of gas meter | index_gas | no | integer | Index of the gas meter |
Monthly due amount | monthly_amount | no | double | Monthly deposit to be paid to the supplier |
Is EAN unknown | ean_unknown | no | boolean | Indicates whether or not the client knows his EAN code |
Tariff card URL | tariff_card | no | string | URL to the tariff card of the product (filled automatically) |
(*) Check the CRM parameters page for additional information on which values are accepted for this field
Dualfuel pack contract parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
EAN code | elec_ean | yes | string | EAN code for day and day-night meters |
Exclusive night EAN code | elec_ean_excl | no | string | EAN code for exclusive night meters |
Meter type | elec_mru_type | yes | enum | Meter type (*) |
Electricity meter number | elec_mru_nr | yes | integer | Meter number of the electricity meter |
Connection type | elec_connection_type | yes | integer | Connection type of the meter (*) |
Electricity usage day | elec_usage_day | no | integer | Usage day in kWh |
Electricity usage night | elec_usage_night | no | integer | Usage night in kWh |
Electricity usage exclusive night | elec_usage_excl | no | integer | Usage exclusive night in kWh |
Has budget meter | elec_has_budget_meter | yes | boolean | Indicates whether or not the client has a budget meter |
Has solar panels | elec_has_solar_panels | yes | boolean | Indicates whether or not the client has solar panels |
Solar inverter capacity | elec_solar_inverter_capacity | no | double | Capacity of the solar inverter in kVa |
Solar installation year | elec_solar_installation_year | no | enum | Year in which the solar panels for the client were installed (*) |
Has digital meter | elec_has_digital_meter | no | boolean | Indicates whether or not the client has a digital meter |
Solar calculation type | elec_solar_calculation_type | no | enum | Method with which the solar contribution is calculated (*) |
Solar injection day | elec_solar_injection_day | no | integer | Solar injection on the day meter in kWh |
Solar injection night | elec_solar_injection_night | no | integer | Solar injection on the night meter in kWh |
Electricity monthly due amount | elec_monthly_amount | no | double | Monthly deposit to be paid to the supplier |
Electricity situation | elec_situation | yes | enum | Situation for which the contract is being created (*) |
Electricity wish date | elec_wishdate | no | date | Preferred date on which the new contract should go into effect |
Current electricity supplier | elec_donor | yes | string | Id of the current supplier |
Client number at current electricity supplier | elec_donor_client_nr | yes | integer | Customer number at current supplier |
Index of day meter | elec_index_day | no | integer | Index of the day meter |
Index of night meter | elec_index_night | no | integer | Index of the night meter |
Index of exclusive night meter | elec_index_excl | no | integer | Index of the exclusive night meter |
Electricity tariff card URL | elec_tariff_card | no | string | URL to the tariff card of the product (filled automatically) |
Gas EAN code | gas_ean | yes | string | EAN code for gas meter |
Gas meter number | gas_mru_nr | yes | integer | Meter number of the gas meter |
Gas Usage | gas_usage | no | integer | Usage in kWh |
Gas unit | gas_unit | no | integer | Unit of the gas usage (kwh, m3) |
Gas situation | gas_situation | yes | enum | Situation for which the contract is being created (*) |
Current gas supplier | gas_donor | yes | string | Id of the current supplier |
Client number at current gas supplier | gas_donor_client_nr | yes | integer | Customer number at current supplier |
Index of gas meter | gas_index | no | integer | Index of the gas meter |
Gas monthly due amount | gas_monthly_amount | no | double | Monthly deposit to be paid to the supplier |
Gas Tariff card URL | gas_tariff_card | no | string | URL to the tariff card of the product (filled automatically) |
Is EAN unknown | ean_unknown | no | boolean | Indicates whether or not the client knows his EAN code |
(*) Check the CRM parameters page for additional information on which values are accepted for this field
Mobile contract parameters
Coming soon!
Examples: electricity contract
// PHP using the econtract/crm package
$contract = Crm::createOrder(
array(
// Client data
'client_gender' => 1,
'client_segment' => 1,
'client_first_name' => 'John',
'client_last_name' => 'Doe',
'client_birthdate' => '1956-12-25',
'client_birthplace' => 'Hasselt',
'client_nationality' => 'BE',
'client_idnr' => 5,
'client_rrnr' => 6,
'client_cellphone' => '012457898',
'client_landline' => '',
'client_fax' => '',
'client_email' => 'john.doe@server.com',
'client_language' => 'nl',
'client_bban' => '',
'client_iban' => '',
'client_bic' => '',
'client_family_size' => 3,
// Address data
'address_street' => 'Street 02',
'address_nr' => 10,
'address_box' => '',
'address_floor' => 4,
'address_postal_code' => 3500,
'address_city' => 'Hasselt',
'address_country' => 'BE',
'address_building_type' => 3,
// Order data
'comparison_id' => 45688954,
'affiliate_id' => 50,
'sales_channel_id' => 1,
'ip_address' => '192.168.1.1',
'remarks' => 'Please fix fast',
'internal_remarks' => 'Fix fast for this customer',
'product_id' => 12,
'supplier_id' => 5,
'payment_method' => 1,
'producttype' => 'electricity',
// Contract details data
'ean' => '',
'ean_excl' => '',
'mru_type' => 2,
'mru_nr' => '',
'connection_type' => 1,
'usage_day' => '',
'usage_night' => '',
'usage_excl' => '',
'has_solar_panels' => false,
'has_budget_meter' => false,
'solar_inverter_capacity' => 0.0,
'solar_installation_year' => null,
'has_digital_meter' => false,
'solar_calculation_type' => 'capacity',
'solar_injection_day' => 0,
'solar_injection_night' => 0,
'monthly_amount' => 80.5,
'situation' => 3,
'wishdate' => null,
'donor' => '',
'donor_client_nr' => '',
'index_day' => '',
'index_night' => '',
'index_excl' => '',
'ean_unknown' => false,
'tariff_card' => '',
)
);
Examples: gas contract
// PHP using the econtract/crm package
$contract = Crm::createOrder(
array(
// Client data
'client_gender' => 1,
'client_segment' => 1,
'client_first_name' => 'John',
'client_last_name' => 'Doe',
'client_birthdate' => '1956-12-25',
'client_birthplace' => 'Hasselt',
'client_nationality' => 'BE',
'client_idnr' => 5,
'client_rrnr' => 6,
'client_cellphone' => '012457898',
'client_landline' => '',
'client_fax' => '',
'client_email' => 'john.doe@server.com',
'client_language' => 'nl',
'client_bban' => '',
'client_iban' => '',
'client_bic' => '',
'client_family_size' => 3,
// Address data
'address_street' => 'SomeStreet',
'address_nr' => 10,
'address_box' => '',
'address_floor' => 4,
'address_postal_code' => 1234,
'address_city' => 'SomeCity',
'address_country' => 'BE',
'address_building_type' => 3,
// Invoice address data (optional)
'invoice_address_street' => 'AnotherStreet',
'invoice_address_nr' => 22,
'invoice_address_box' => '',
'invoice_address_floor' => 1,
'invoice_address_postal_code' => 2345,
'invoice_address_city' => 'AnotherCity',
'invoice_address_country' => 'BE',
'invoice_address_building_type' => 3,
// Order data
'comparison_id' => 45688954,
'affiliate_id' => 50,
'sales_channel_id' => 1,
'ip_address' => '192.168.1.1',
'remarks' => 'Please fix fast',
'internal_remarks' => 'Fix fast for this customer',
'product_id' => 12,
'supplier_id' => 5,
'payment_method' => 1,
'producttype' => 'gas',
// Contract details data
'ean' => '',
'mru_nr' => '',
'usage_gas' => '',
'situation' => 3,
'donor' => '',
'donor_client_nr' => '',
'index_gas' => '',
'monthly_amount' => 80.5,
'ean_unknown' => false,
'tariff_card' => '',
)
);
Create lead
Resource | HTTP format | Method | Description |
---|---|---|---|
Lead | POST | /api/leads | Create a new lead in the CRM |
Creating leads works similar as creating contracts. There are a number of general parameters that can be supplied for every lead, but also several additional parameters that may be added depending on the type of lead that you want to create. Below you will find a list of the general parameters, as well as all parameters for all available lead types that can be submitted to the CRM.
Aside from an array of data, you will also need to specify the type of lead you want to create. This can be done by passing the type as the first parameter to the createLead
method and the data array as the second parameter as shown in the example below. In some cases, a utility method exists for a specific lead type. If this is the case, the utility method should be used to ensure proper request handling. All available types and data sets are listed below.
Parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
Gender | gender | yes | enum | Gender (*) |
Market segment | segment | yes | enum | Market segment (*) |
First name | first_name | yes | string | First name |
Last name | last_name | yes | string | last name |
Birth date | birthdate | no | date | Birth date (YYYY-MM-DD) |
Cellphone | cellphone | no | string | Cellphone (04xxxxxxxx) |
Cellphone country | cellphone_country | no | string | Country in which the cellphone is registered (BE, NL, FR, DE, ...) |
Landline | landline | no | string | Landline (0xxxxxxxx) |
Landline country | landline_country | no | string | Country in which the landline is registered (BE, NL, FR, DE, ...) |
yes | string | |||
Language | language | yes | string | Language (nl, fr) |
Product type ID | producttype_id | no | integer | ID of the product type which the lead in interested (does not apply to every lead) |
Supplier ID | supplier_id | no | integer | ID of the supplier in which the lead in interested (does not apply to every lead) (*) |
Product ID | product_id | no | integer | ID of the product in which the lead in interested (does not apply to every lead) |
Affiliate ID | affiliate_id | no | integer | ID of the affiliate through which the lead was created |
Remarks | remarks | no | string | Remarks that are useful for the processing of the lead by our agants |
Cookie ID | cookie_id | no | string | |
IP address | ip_address | no | integer | IP address of the client for the lead is created |
Lead type | lead_type | yes | string | Type of lead you are creating. Is added as first parameter to the createLead method in the PHP package. When not using the package, this parameter must be added manually |
(*) Check the CRM parameters page for additional information on which values are accepted for this field
Third party lead
- Lead type: third_party
- Utility method: n/a
Parameters
In addition to the default parameter mentioned above, the Third party Leads also has several additional parameters that are unique to this particular lead type. They must be used in combination with the default parameters if applicable (see example below):
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
Batch identifier | batch | no | string | Batch description that will be used to identify a specific batch of leads for reporting purposes |
Is hot | is_hot | no | boolean | Indicated whether or not this is a very recent lead (default: false) |
Call back time | call_at | no | timestamp | Timestamp at which the lead is to be called bak (format: YYYY-MM-DD HH:II:SS) |
Validation
For third party leads, there are also some additional validation rules that need to be taken into account.
- cellphone: required if
landline
is not provided - cellphone_country: required if
cellphone
is provided - landline: required if
cellphone
is not provided - landline_country: required if
landline
is provided - vat: required if
company
is provided - iban: required if
iban
is provided - address_street: required if
address_nr
is provided - address_nr: required if
address_street
is provided - address_postal_code: required if either
address_street
oraddress_nr
is provided
Examples
// PHP using the econtract/crm package
$lead = Crm::createLead(
'third_party',
array(
// Lead data
'supplier_id' => 542,
'remarks' => 'Client is interested in solar panels',
// Client data
'first_name' => 'John',
'last_name' => 'Doe',
'language' => 'nl',
'email' => 'john.doe@server.com',
'cellphone' => '0499656565',
'cellphone_country' => 'BE',
// Address data
'address_street' => 'SomeStreet',
'address_nr' => 10,
'address_box' => '',
'address_floor' => 4,
'address_postal_code' => 1234,
'address_city' => 'SomeCity',
'address_country' => 'BE',
'address_building_type' => 3,
'batch' => 'leadData_energy_2021-03-22',
'is_hot' => false,
'call_at' => '2021-03-22 15:30',
)
);
Insurance lead
- Lead type: insurance
- Utility method: n/a
Parameters
In addition to the default parameter mentioned above, the Insurance Leads also has several additional parameters that are unique to this particular lead type. They must be used in combination with the default parameters if applicable (see example below):
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
Interested in insurance | interested_in_insurance | yes | boolean | Indicated whether the client is interested in a new offer for insurances (default: false) |
Allow insurance call | allow_insurance_call | yes | boolean | Indicated whether the client is open to receiving a call with regards to insurance (default: false) |
Interests | interests | yes | array | List of types of insurance which are of interest to the client (options: 'car', 'dog', 'funeral', 'fire', 'hospitalization') |
Examples
// PHP using the econtract/crm package
$lead = Crm::createLead(
'insurance',
array(
// Lead data
'supplier_id' => 542,
'remarks' => 'Client is interested in solar panels',
// Client data
'first_name' => 'John',
'last_name' => 'Doe',
'language' => 'nl',
'email' => 'john.doe@server.com',
'cellphone' => '0499656565',
'cellphone_country' => 'BE',
// Address data
'address_street' => 'SomeStreet',
'address_nr' => 10,
'address_box' => '',
'address_floor' => 4,
'address_postal_code' => 1234,
'address_city' => 'SomeCity',
'address_country' => 'BE',
'address_building_type' => 3,
'interested_in_insurance' => true,
'allow_insurance_call' => true,
'interests' => array(
'fire',
'car',
'dog',
),
)
);
Click-out lead
Resource | HTTP format | Method | Description |
---|---|---|---|
Lead | POST | /api/leads/clickOut | Create a new click-out lead in the CRM |
- Utility method: createClickOutLead()
Coming soon!
Examples
// PHP using the econtract/crm package
$lead = Crm::createClickOutLead(
array(
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john.doe@server.com',
'product_type_id' => 3,
'supplier_id' => 43,
'product_id' => 53,
'url' => 'http://foo.com/bar',
)
);
CallMeBack lead
- Lead type: call_me_back
- Utility method: createCallMeBackLead()
Examples
// PHP using the econtract/crm package
$lead = Crm::createCallMeBackLead(
array(
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john.doe@server.com',
'phone' => '0499656565',
'producttype_id' => 3,
'product_id' => 4,
'supplier_id' => 5,
'affiliate_id' => 6,
'subject' => 'Foo_subject',
'remarks' => 'Foo_remarks',
'call_at' => '2016-04-15 12:00:00',
'call_until' => '2016-04-15 18:00:00',
'deal_closed' => false,
)
);
Get Latest Orders
Resource | HTTP format | Method | Description |
---|---|---|---|
latests | POST | /api/latest | Fetch latest orders from CRM |
Parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
Age | age | no | integer | Max age of the orders returned. |
Zipcode | address_zipcode | no | integer | Zipcode where to limit the results to |
Language | client_language | no | nl/fr | Language of the client |
Product Type | product_type | no | string | Producttype filter |
- Utility method: latest( $parameters, $limit = 10)
Get supplier ratings
Resource | HTTP format | Method | Description |
---|---|---|---|
suppliers | GET | /api/suppliers/{id}/rating | Fetch the supplier rating based on the CRM order feedback |
Parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
ID | id | yes | integer | ID of the supplier (see [/crm-parameters](#CRM parameters) ) |
Examples
// PHP using the econtract/crm package
$response = Crm::getSupplierRating( 10 );
Get default usages
Resource | HTTP format | Method | Description |
---|---|---|---|
usages | GET | /api/usages | Fetch default usages from CRM |
Parameters
Name | Parameter | Required | Type | Description |
---|---|---|---|---|
Product Type | producttype | yes | string | Producttype filter |
Segment | segment | yes | string | Segment (see [/crm-parameters](#CRM parameters) ) |
Family size | family_size | no | string | Family size (0 to 5) ) |
Residence type | residence_type | no | string | Residence types (see [/crm-parameters](#CRM parameters) ) |
Home size | home_size | no | integer | Home sizes in square meters) |
Meter type | meter_type | no | string | Electricity meter type (see [/crm-parameters](#CRM parameters) ) |
Has Solar | has_solar | no | string | Family size (see [/crm-parameters](#CRM parameters) ) |
Has roof isolation | roof_isolation | no | bool | 0 => 'No / No idea', 1 => Yes |
Has wall isolation | wall_isolation | no | bool | 0 => 'No / No idea', 1 => Yes |
Glass type | glass | no | string | single, double |
Age of boiler | boiler | no | string | <10, >10 |
Age of central heating | cv | no | string | <10, >10 |
- Utility method: usages( $parameters)
Examples
// PHP using the econtract/crm package
$response = Crm::getDefaultUsages(
array(
'producttype' => 'electricity',
'segment' => 1,
'family_size' => 3,
'residence_type' => 2,
'meter_type' => 2,
'has_solar' => 1,
'roof_isolation' => 1,
'wall_isolation' => 1,
'boiler' => '>10',
)
);
https://crm.econtract.be/api/usages?producttype=dualfuel_pack&segment=1&meter_type=3&has_solar=0&family_size=4&residence_type=3&crm_api_id=ZP6WvdAzIuLS&crm_api_key=qtWKfDeE2FBHx3Q3OccJWYZmTs4ixCo1yn156S5p3tB6R8jgnd2NytaUJuXNE1eV&roof_isolation=1&cv=%3C10&cv=%3C10