This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Companies in Clevertim CRM



Overview

The following operations allow you to work with companies. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with companies, see Sample configuration.

OperationDescription

createCompany

Creates a new company.

getCompanyRetrieves a specific company.
listCompaniesRetrieves all companies.

Operation details

This section provides further details on the operations related to companies.

Creating a new company

The createCompany operation creates a new company.

createCompany
<clevertimcrm.createCompany>
    <companyName>{$ctx:companyName}</companyName>
    <description>{$ctx:description}</description>
    <email>{$ctx:email}</email>
    <phones>{$ctx:phones}</phones>
    <website>{$ctx:website}</website>
    <address>{$ctx:address}</address>
    <city>{$ctx:city}</city>
    <postCode>{$ctx:postCode}</postCode>
    <country>{$ctx:country}</country>
    <socialMediaIds>{$ctx:socialMediaIds}</socialMediaIds>
    <customerType>{$ctx:customerType}</customerType>
    <customFields>{$ctx:customFields}</customFields>
	<tags>{$ctx:tags}</tags>
</clevertimcrm.createCompany> 
Properties
  • companyName: Required - The name of the company.
  • description: The description of the company.
  • email: The email address of the company.
  • phones: The phone numbers of the company.
  • website: The website of the company. Should be a valid web address.
  • address: The postal address of the company.
  • city:  The city that the company is in.
  • postCode:  The postal code of the area that the company is located.
  • country:  The country that the company is located.
  • socialMediaIds:  Social media identifiers for the company. 
  • customerType:  The type of the customer.
  • customFields:  Custom fields. These can be provided as name and value pairs.
  • tags:  The tags that can be specified for the company. You can provide one or more tags.
Sample request

Following is a sample REST/JSON request that can be handled by the createCompany operation.

Sample Request for createCompany
{
	"apiUrl":"https://www.clevertim.com",
	"apiKey":"crRudgr0Q0QVmxLLc8gkPmrfO9BCe7u6dqe3wF7FOPtrTKI6KLZ12577",
	"companyName":"testSOAPCase7", 
	"description":"Sample Description",
	"email":["amanda.bellur@gmail.com", "feron@yahoo.com"],
	"phones":[{"type": "Work", "no": "008745849854"}, {"type": "Home", "no": "87450-94545"}],
	"website":["http://www.amanda.com", "http://www.feron.com"],
	"address":"200 Marbello Road",
	"city":"London",
	"postCode":"SW9 2BR",
	"country":"United Kingdom",
	"socialMediaIds":[{"type": "Twitter", "smid": "clevertim"}, {"type": "Facebook", "smid": "mikesperanza"}],
	"customerType":"C",
	"customFields":{"540": "China"},
	"tags":["Europe", "twitter", "important"]
}
Related Clevertim CRM documentation

https://github.com/clevertim/clevertim-crm-api/blob/master/resources/company.md#add-a-new-company

Retrieving a company

The getCompany operation retrieves a specific company.

getCompany
<clevertimcrm.getCompany>
	<id>{$ctx:id}</id>
</clevertimcrm.getCompany> 
Properties
  • id: Required - The ID of the company you need to retrieve.
Sample request

Following is a sample REST/JSON request that can be handled by the getCompany operation.

getCompany
{ 
	"apiUrl":"https://www.clevertim.com",
	"apiKey":"5aQznhokY2RkkDTiOQBYBTitarCfqmoLIKTkjafhUxCFGs3DHNZ12576",
	"id":"156273"
} 
Related Clevertim CRM documentation

https://github.com/clevertim/clevertim-crm-api/blob/master/resources/company.md#get-a-specific-company

Retrieving all companies

The listCompanies operation retrieves all the companies.

listCompanies
</clevertimcrm.listCompanies>
Sample request

Following is a sample REST/JSON request that can be handled by the listCompanies operation.

listCompanies
{
	"apiUrl":"https://www.clevertim.com",
	"apiKey":"5aQznhokY2RkkDTiOQBYBTitarCfqmoLIKTkjafhUxCFGs3DHNZ12576"
}
Related Clevertim CRM documentation

https://github.com/clevertim/clevertim-crm-api/blob/master/resources/company.md#get-all-companies

Sample configuration

Following is a sample proxy service that illustrates how to connect to Clevertim CRM with the init operation and use the createCompany operation. The sample request for this proxy can be found in createCompany sample request. You can use this sample as a template for using other operations in this category.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="ClevertimCRM_createCompany"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="apiKey" expression="json-eval($.apiKey)"/>
         <property name="companyName" expression="json-eval($.companyName)"/>
         <property name="description" expression="json-eval($.description)"/>
         <property name="email" expression="json-eval($.email)"/>
         <property name="phones" expression="json-eval($.phones)"/>
         <property name="website" expression="json-eval($.website)"/>
         <property name="address" expression="json-eval($.address)"/>
         <property name="city" expression="json-eval($.city)"/>
         <property name="postCode" expression="json-eval($.postCode)"/>
         <property name="country" expression="json-eval($.country)"/>
         <property name="socialMediaIds" expression="json-eval($.socialMediaIds)"/>
         <property name="customerType" expression="json-eval($.customerType)"/>
         <property name="customFields" expression="json-eval($.customFields)"/>
         <property name="tags" expression="json-eval($.tags)"/>
         <clevertimcrm.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <apiKey>{$ctx:apiKey}</apiKey>
         </clevertimcrm.init>
         <clevertimcrm.createCompany>
            <companyName>{$ctx:companyName}</companyName>
            <description>{$ctx:description}</description>
            <email>{$ctx:email}</email>
            <phones>{$ctx:phones}</phones>
            <website>{$ctx:website}</website>
            <address>{$ctx:address}</address>
            <city>{$ctx:city}</city>
            <postCode>{$ctx:postCode}</postCode>
            <country>{$ctx:country}</country>
            <socialMediaIds>{$ctx:socialMediaIds}</socialMediaIds>
            <customerType>{$ctx:customerType}</customerType>
            <customFields>{$ctx:customFields}</customFields>
            <tags>{$ctx:tags}</tags>
         </clevertimcrm.createCompany>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>