Contact Centre

Companies

Contact Centre Companies API documentation

Account Summary

This API call will return summary data related to companies loaded.

Path
/workflow/company/details

Request (POST)

Any of the following fields can be sent

Field nameData typeDescription
company_namestringCompany name. Does an approximate match e.g. you can search for ‘my co’ and it would return ‘my company’ for example.
registration_numberstringCompany registration number
iduuidDatabase record id, in the workflow
recordbooleanIf true show record section
subscriptionsbooleanIf true show subscriptions section
bank_accountsbooleanIf true show bank_accounts section
transactionsbooleanIf true show transactions section

Response (JSON)

Data is returned as a JSON object in the following format with multiple sections:

{
  "record": {
    "registration_number": 12345678,
    ......
  },
  "subscriptions": [{
    "date_start": "2020-03-12",
    ......
  }, ...],
  "bank_accounts": [{
    "accounts_holder": "J Smith",
    ......
  }, ...],
  "transactions": [{
    "transaction_number": "2865fca2-db87-4e37-8dd3-c350cd639a5c",
    ......
  }, ...],
}

Record section

Field name

Data type

Description

member_number

number

Membership number

registration_number

number

Company registration number

name

string

Name of the company

email

string

Email

country

string

Country the person resides in

region

string

province/state associated with

above country

municipality

string

Municipality associated with the region

trading_as

string

Company registered trading name

contact

string

Contact number for the company

mobile

string

Mobile number for the company

fax

string

Fax number for the company

website

string

Company website address

balance_open

number

Journal opening balance

is_taxable

boolean

If the company is taxable or not

default_accounts_tax_id

string

Default account tax ID

day_billing

number

Default billing day for the company

tax_reference

string

Tax reference

description

string

Description associated with the company

social_facebook

string

Facebook URL

social_linkedin

string

Linkedin URL

social_instagram

string

Instagram URL

social_twitter

string

Twitter URL

social_pinterest

string

Pinterest URL

social_blog

string

Blog URL

social_whatsapp

string

Whatsapp number

social_telegram

string

Telegram number

web_referrer

string

Web referrer for this record

utm_campaign

string

UTM campaign parameter

utm_source

string

UTM source parameter

utm_medium

string

UTM medium parameter

utm_content

string

UTM content parameter

utm_term

string

UTM term parameter

branch

string

Branch account was recruited at

agent

string

Agent who recruited account

physical_line_1

string

Physical address line 1

physical_line_2

string

Physical address line 2

physical_line_3

string

Physical address line 3

physical_line_4

string

Physical address line 4

physical_code

number

Physical postal code

postal_line_1

string

Postal address line 1

postal_line_2

string

Postal address line 2

postal_line_3

string

Postal address line 3

postal_line_4

string

Postal address line 4

postal_code

string

Postal code

is_marketing_sms

boolean

Can send sms marketing

is_marketing_whatsapp

boolean

Can send WhatsApp marketing

is_marketing_email

boolean

Can send email marketing

is_marketing_phone

boolean

Can send phone marketing

is_active

boolean

Is user an active member

company_type

string

Company type e.g. Public Limited Company

currency

string

Currency for the account e.g. ZAR

created_at

timestamp

When record was created

updated_at

timestamp

When record was updated

date_closed

date

Date company closed

date_balance_open

date

Date associated with journal opening balance

date_expire

date

Date company record became invalid

contact_name

string

Contact person name

contact_surname

string

Contact person surname

contact_title

string

Contact person title

language

string

Language

custom_fields

object

Optional custom fields associated with the record

branches_regions_title

string

Region associated with the branch

owner_admins

array

List of admin owners related to this record

visible_to_title

string

Visibility group of the record

deal_value

number

How much the deal is worth

deal_accounts_currencies_title

string

Currency associated with the deal value

deal_expected_close_date

date

When the deal is expected to close

is_blacklisted

boolean

Has this company been flagged as blacklisted

total_successful_transactions

number

Total number of successful transactions for this record

total_failed_transactions

number

Total number of failed transactions for this record

total_subscriptions

number

Total number of subscriptions associated with the record

total_subscriptions_products

number

Total number of subscription products associated with the record

total_active_subscriptions_products

number

Total number of active subscription products associated with the record

call_last_contacted_by_agents_title

string

Agent that last contacted the company by call

call_last_contacted

date

Date when last the company was contacted via call

date_phone_invalid

date

Date when the phone number was deemed invalid

date_lead_conversion

date

Date when the company was converted from a lead to an account

date_paid_up

date

Date until when the company is deemed to be paid up

address_details_changed_at

date

Date when the address details of the company was changed

contact_details_changed_at

date

Date when the contact details of the company was changed

last_engagement_at

date

Date when the company was last engaged with

status_changed_at

date

Date when the status of the company was last changed at

source_of_record_title

string

Source of the record e.g. API

referred_by

string

Who this company was referred by

Subscription section

Field name

Data type

Description

id

uuid

Unique ID

date_start

date

Date when subscription should start

date_end

date

Date when subscription should end. Blank will run forever.

bank_accounts_id

uuid

Bank account ID

products

array

List of products under this subscription

status

string

Active, Disputed, Disabled

Products (array of objects)

name

string

Name of product

amount

decimal

Amount ZAR of product

quantity

number

How many products were added

total

decimal

Total amount (amount * quantity)

branch

string

Branch product was recruited at

project

string

Project product was recruited under

agent

string

Agent who commissions should be paid out to

is_active

boolean

Is product under subscription active

created_at

timestamp

When product was created

updated_at

timestamp

When product was updated

reference_number

string

Reference provided when the API call was made

Bank accounts section

Field name

Data type

Description

id

uuid

Unique ID

account_holder

string

Name of bank account holder

account_number

string

Bank account number

account_type

string

Bank account type

bank

string

Bank name

branch_code

string

Bank branch code

Transactions section

Field name

Data type

Description

transaction_number

string

Unique number

amount

decimal

Amount collected

status

string

Paid, Transaction Accepted, Disputed, Unpaid

transaction_date

timestamp

When the transaction was processed

Items (array of objects)

name

string

Name of the product paid for.

unique_id

string

Unique ID associated with the product.

unit_name

string

Unit name of the product.

unit_label

string

Unit label of the product.

accounting_code

string

Accounting code associated with the product.

amount

decimal

Amount paid for.

reference_number

string

Reference number submitted on the initial workflow API call.

Add New Company

This API call provides for loading new companies onto the platform.

Path
/workflow/company/create

Request (POST) JSON Array

Field nameData typeRequiredDescription
account_bankstringC[16], LBank name
account_branch_codestringC[12], LBank branch code
account_namestringC[13]Bank account holder name
account_numberstringC[14]Bank account number
account_typestringC[15], LBank account type
agentstringN, LAgent who recruited account
balance_opennumberNJournal opening balance in Rands
billing_daynumberC[21]Day of debit order run for product (0 - 31). Only applicable if product details above have been provided.
branchstringN, LBranch account was recruited at
company_typestringY, LCompany type
contact_namestringNName of Person to contact
contact_surnamestringNSurname of Person to contact
contact_titlestringN, LTitle of Person to contact
contactstringNContact number
countrystringN, LCountry the company is located in. Defaults to South Africa
custom_fieldsObjectNObject containing all optional custom fields returned by /lookups/custom_fields/people. E.g. { "spouse name": "Jane" }
date_balance_opendateNDate journal balance was opened
date_closeddateNDate company closed down
date_expiredateNDate company record became invalid
deal_accounts_currencies_idstringN, LCurrency associated with the deal value
deal_expected_close_datedateNExpected closing date for the deal
deal_valuenumberNAmount expected to be gained from the deal e.g. 12500.0 ZAR
default_accounts_tax_idstringNDefault account tax id
default_billing_daystringC[22]Default debit order day for the company
descriptionstringNCompany description
emailstringYEmail
faxstringNFax number
is_activebooleanNCompany record is to be active. Defaults to true.
is_blacklistedbooleanNIf this company has been flagged as blacklisted
is_marketing_emailbooleanNCan send email marketing
is_marketing_phonebooleanNCan send phone marketing
is_marketing_smsbooleanNCan send sms marketing
is_marketing_whatsappbooleanNCan send WhatsApp marketing
is_taxablebooleanNCompany is taxable
languagestringN, LLanguage (Same lookup as people)
mobilestringNMobile number
municipalityStringN, LMunicipality associated with the region
namestringYCompany Name, must be unique
owner_admins_idsarrayN, LArray of admin IDs to whom the record belongs
physical_codenumberNPhysical postal code
physical_line_1stringNPhysical address line 1
physical_line_2stringNPhysical address line 2
physical_line_3stringNPhysical address line 3
physical_line_4stringNPhysical address line 4
postal_codestringNPostal code
postal_line_1stringNPostal address line 1
postal_line_2stringNPostal address line 2
postal_line_3stringNPostal address line 3
postal_line_4stringNPostal address line 4
product_amountNumberC[18]Amount company is paying for the product in Cents e.g. 150 for R1.50
product_namestringC[17], LName of the product company is subscribed to
product_subscription_start_datedateC[20]When the subscription to the product is to start. If the product interval is greater than 1 month e.g. yearly, you may not pick a date that was already submitted in a batch. A good rule is that the starting date should be at least 12 days from now.
product_unit_namestringC[19], LHow frequently the product is billed
projectstringN, LProject account was recruited under
reference_numberstringNCustom reference number to tag the product with and display on workflow reporting.
regionstringN, LProvince/State the company is located in. Defaults to none/unknown
registration_numberstringNRegistration number
social_blogstringNBlog URL
social_facebookstringNFacebook URL
social_instagramstringNInstagram URL
social_linkedinstringNLinkedIn URL
social_pintereststringNPinterest URL
social_telegramstringNTelegram number
social_twitterstringNTwitter URL
social_whatsappstringNWhatsApp number
tax_referencestringNCompany tax reference
trading_asstringYRegistered trading name
utm_campaignstringNUTM campaign parameter
utm_contentstringNUTM content parameter
utm_mediumstringNUTM medium parameter
utm_sourcestringNUTM source parameter
utm_termstringNUTM term parameter
web_referrerstringNWeb referrer URL
websitestringNWebsite address
visible_to_lookups_idstringN, LVisibility group associated with the record

Response (JSON)

Data is returned as a JSON object in the following format with multiple sections:

{
  "Info": {
    "companies": {
      "accepted": 12345,
      "rejected": 678
    }
  },
  "accepted": [{...}],
  "rejected": [{
    "reasons": {  
      "account_number": {
        "message": "CDV check failed", 
        "rule": "CDV"
      }
    },
    "name": "xxxxxxxxxxxx",
    ...
  }, ...]
}

Info section

Sub-section

Field name

Data type

Description

companies

accepted

number

Number of records accepted

companies

rejected

number

Number of records rejected (See rejected section for more details)

Rejected section

Field name

Data type

Description

reasons

object

The reason why the record was rejected; some examples include:

  • Person already exists
  • Branch code format incorrect
  • Account number format incorrect
  • Account name format incorrect
  • CDV check failed

The reasons are given per input key that failed the validation e.g. "account_number".

name

string

Name associated with the rejected record (company name)

Accepted section

Field name

Data type

Description

unique_workflow_id

string

Unique ID associated with the submission. Can be used to cancel the item if it is still pending.

name

string

Name associated with the rejected record (company name)

Update Company

This API call provides for updating the details of existing companies on the platform.

Same conditions follow for bank account and product details as in creation i.e. if one bank account detail is to be updated all bank account details have to be provided.

Product details can only be provided when the company is currently inactive, in which case all their previously active subscriptions will be disabled before creating a new subscription (automatically reactivating them as well) or adding subscriptions to companies that currently have no active subscriptions. To add products to an existing subscription use the ‘add product’ API call.

Path
/workflow/company/update

Request (POST) JSON Array

Field nameData typeRequiredDescription
account_bankstringN, LBank name
account_branch_codestringN, LBank branch code
account_namestringNBank account holder name
account_numberstringNBank account number
account_typestringN, LBank account type
agentstringN, LAgent who recruited account
balance_opennumberNJournal opening balance in rands
billing_daynumberNDay of debit order run for product (0 - 31). Only applicable if product details above have been provided.
branchstringN, LBranch account was recruited at
company_typestringN, LCompany type
contact_namestringNName of Person to contact
contact_surnamestringNSurname of Person to contact
contact_titlestringN, LTitle of Person to contact
contactstringNContact number
countrystringN, LCountry the company is located in. Defaults to South Africa
custom_fieldsObjectNObject containing all optional custom fields returned by /lookups/custom_fields/people. E.g. { "spouse name": "Jane" }
date_balance_opendateNDate journal balance was opened
date_closeddateNDate company closed down
date_expiredateNDate company record became invalid
deal_accounts_currencies_idstringN, LCurrency associated with the deal value
deal_expected_close_datedateNExpected closing date for the deal
deal_valuenumberNAmount expected to be gained from the deal e.g. 12500.0 ZAR
default_accounts_tax_idstringNDefault account tax id
default_billing_daystringNDefault debit order day for the company
descriptionstringNCompany description
emailstringNEmail
faxstringNFax number
is_activebooleanNCompany record is to be active
is_blacklistedbooleanNIf this company has been flagged as blacklisted
is_marketing_emailbooleanNCan send email marketing
is_marketing_phonebooleanNCan send phone marketing
is_marketing_smsbooleanNCan send sms marketing
is_marketing_whatsappbooleanNCan send WhatsApp marketing
is_taxablebooleanNCompany is taxable
languagestringN, LLanguage (Same lookup as people)
mobilestringNMobile number
municipalityStringN, LMunicipality associated with the region
namestringYCompany Name. Must be unique and exist in the DB. Name is case insensitive but additional characters would affect the result. ‘MY COMPANY’ is the same as ‘My Company’ but ‘My Company LTD’ would not be found for example. Use the ‘Account Summary’ API call to find the correct names.
owner_admins_idsarrayN, LArray of admin IDs to whom the record belongs
physical_codenumberNPhysical postal code
physical_line_1stringNPhysical address line 1
physical_line_2stringNPhysical address line 2
physical_line_3stringNPhysical address line 3
physical_line_4stringNPhysical address line 4
postal_codestringNPostal code
postal_line_1stringNPostal address line 1
postal_line_2stringNPostal address line 2
postal_line_3stringNPostal address line 3
postal_line_4stringNPostal address line 4
product_amountNumberNAmount company is paying for the product in Cents e.g. 150 for R1.50
product_namestringN, LName of the product company is subscribed to. See description above for when to use product inputs.
product_subscription_start_datedateNWhen the subscription to the product is to start. If the product interval is greater than 1 month e.g. yearly, you may not pick a date that was already submitted in a batch. A good rule is that the starting date should be at least 12 days from now.
product_unit_namestringN, LHow frequently the product is billed
projectstringN, LProject account was recruited under
reference_numberstringNCustom reference number to tag the product with and display on workflow reporting.
regionstringN, LProvince/State the company is located in. Defaults to none/unknown
registration_numberstringNRegistration number
social_blogstringNBlog URL
social_facebookstringNFacebook URL
social_instagramstringNInstagram URL
social_linkedinstringNLinkedIn URL
social_pintereststringNPinterest URL
social_telegramstringNTelegram number
social_twitterstringNTwitter URL
social_whatsappstringNWhatsApp number
tax_referencestringNCompany tax reference
trading_asstringNRegistered trading name
utm_campaignstringNUTM campaign parameter
utm_contentstringNUTM content parameter
utm_mediumstringNUTM medium parameter
utm_sourcestringNUTM source parameter
utm_termstringNUTM term parameter
web_referrerstringNWeb referrer URL
websitestringNWebsite address
visible_to_lookups_idstringN, LVisibility group associated with the record

Response (JSON)

Data is returned as a JSON object in the following format with multiple sections:

{
  "Info": {
    "companies": {
      "updated": 12,
      "rejected": 3
    }
  },
  "accepted": [{...}],
  "rejected": [{
  "reasons": {  
    "account_number": {
      "message": "CDV check failed",
      "rule": "CDV"
    }
  },
  "name": "xxxxxxxxxxxx",
  ...
  }, ...]
}

Info section

Sub-section

Field name

Data type

Description

companies

updated

number

Number of records updated

companies

rejected

number

Number of records rejected (See rejected section for more details)

Rejected section

Field name

Data type

Description

reasons

object

The reason why the record was rejected; some examples include:

  • Person already exists
  • Branch code format incorrect
  • Account number format incorrect
  • Account name format incorrect
  • CDV check failed

The reasons are given per input key that failed the validation e.g. "account_number".

name

string

Name associated with the rejected record (company name)

Accepted section

Field name

Data type

Description

unique_workflow_id

string

Unique ID associated with the submission. Can be used to cancel the item if it is still pending.

name

string

Name associated with the rejected record (company name)

Add Product

Add a product to the subscription (or the latest active subscription) for a specified company. Subscription product agents will be based on the agent that is associated with the API token used. Body input must be an object and not an array.

Path
/workflow/company/product/add

Request (POST)

Field nameData typeRequiredDescription
product_namestringY, LName of the product to be added for the person.
company_namestringYName of the company paying for the product. Must be unique and exist in the DB. Name is case insensitive but additional characters would affect the result. ‘MY COMPANY’ is the same as ‘My Company’ but ‘My Company LTD’ would not be found for example. Use the ‘Account Summary’ API call to find the correct names.
account_id_numberstringNUsed when paying for a specific person. ID number of the person the product is for.
subscription_idstringNID of the subscription to add the product to. Obtained from ‘Account Summary’. Defaults to the latest active subscription of the company; with active banking details.
amountNumberYAmount to be paid for the product; in cents.
branchstringN, LBranch product was recruited at
projectstringN, LProject product was recruited under
agentstringN, LAgent selling the product
reference_numberstringNCustom reference number to tag the product with and display on workflow reporting.

Response (JSON)

Data is returned as a JSON object in the following format:

{
  "billing_day": 1,
  "amount": 20000,
  "payer_name": "xxxxxxxxxxxxx",
  "account_id_number": "xxxxxxxxxxxxx",
  "product_name": "Product 123",
  "unique_workflow_id": "xxxxxxxxx",
  "errors": [{
    "message": "abc",
    "rule": "uuid"
  }]
}

Field name

Data type

Description

billing_day

Number

Day on which the next payment will be made

amount

Number

Amount in cents to be deducted from the person

payer_name

String

Name of the company paying for the product

account_id_number

String

ID number of the person receiving the product (if applicable).

product_name

String

Name of the product being paid for

unique_workflow_id

String

Unique ID associated with this workflow submission. Can be used to cancel a pending workflow item.

Errors Section

message

String

Reason why the submission was rejected:

  • Company name does not exist
  • Account ID number does not exist
  • Product not found
  • No active subscription found for the payer
  • Bank details of the payer is not valid
  • Subscription ID not found
  • Branch not found
  • Project not found
  • The subscription id value is malformed
  • The branch value is malformed
  • The project value is malformed
  • etc.

rule

String

Rule associated with the message e.g. ‘uuid’

Add Subscription

Add a new subscription for the specified company. Subscription product agents will be based on the agent that is associated with the API token used. Body input must be an object.

Path
/workflow/company/subscription/add

Request (POST)

Field nameData typeRequiredDescription
product_namestringY, LName of the product to be added for the person.
company_namestringYName of the company paying for the product. Must be unique and exist in the DB. Name is case insensitive but additional characters would affect the result. ‘MY COMPANY’ is the same as ‘My Company’ but ‘My Company LTD’ would not be found for example. Use the ‘Account Summary’ API call to find the correct names.
account_id_numberstringNUsed when paying for someone else e.g. a spouse. ID number of the person the product is for; defaults to the person specified with ‘id_number’.
amountnumberYAmount to be paid for the product; in cents.
agentstringN, LName of the related agent, if not same as that specified by the API token
branchstringN, LBranch product was recruited at
projectstringN, LProject product was recruited under
start_datedateNDate when subscription is to start, defaults to next billing day
end_datedateNDate when subscription is to end, leave empty for no end date
billing_daynumberYCalendar day to make deductions on, 1 to 31
default_payment_methods_idstringY, LPayment method to be used with the subscription See ‘/api/1.0/lookups?category=Payment Methods’
bank_account_namestringCBank account holder name. Required when the payment method used is a debit order.
bank_account_numberstringCBank account number. Required when the payment method used is a debit order.
bank_account_bankstringC, LName of the bank that the bank account number belongs to e.g. "ABSA’. See ‘/api/1.0/lookups/bank/names’. Required when the payment method used is a debit order.
bank_account_type_lookups_idstringC, LType of bank account used e.g. ‘Cheque/Current". See ‘/api/1.0/lookups/bank/accounts’. Required when the payment method used is a debit order.
bank_account_branch_codestringCBranch code associated with the bank account number. Required when the payment method used is a debit order.

Response (JSON)

Data is returned as a JSON object in the following format:

{  
  "status": true,
  "errors": null,
  "billing_day": 1,
  "amount": 20000,
  ...
}
Field nameData typeDescription
statusbooleanTrue if the call succeeded, false if there is an error
errorsobjectObject specifying the problem with inputs e.g.
{
  "product_name" {
    "message": "Product not found",
    "rule": "Lookup"
  }
}
Field nameData typeDescription
billing_daynumberDate of month payment is to be deducted on, 1 to 31
amountnumberAmount to be paid for the product; in cents.
subscription_start_datedateWhen the subscription will start running, the first payment will be on the first billing day after this date and then repeat every interval from that date (based on the product interval)
subscription_end_datedateWhen the subscription is to stop running
account_id_numberstringID Number of the person being paid for
product_namestringName of the product being paid for
unique_workflow_idstringUnique ID associated with this workflow submission. Can be used to cancel a pending workflow item.
payer_namestringName of the company paying for the product

Blacklist

Get a list of blacklisted phone numbers where the user requested not to be contacted.

Path
/companies/blacklist/{sms/phone}

Request (POST)

Field nameData typeRequiredDescription
startdateNStart date filter on when record was flagged not to contact
enddateNEnd date filter on when record was flagged not to contact

Response (JSON)

Data is returned as a JSON object in the following format:

{
  "status": true,
  "data": [{
    "cellphone": "081234567",
    "contact": "081234567",
  }]
  "error": "String message"
}

| |

Field name

Data type

Description

cellphone

String

Contact number

contact

String

Contact number

Errors Section

message

String

Reason why the API call failed:

  • Incorrect type passed
  • The start date is not in the correct format
  • The end date is not in the correct format

rule

Type

Type in URL needs to be either "sms" or "phone"

rule

Date

Start and end date needs to be in format YYYY-MM-DD or 2021-01-01

  1. Required if day_salary is not provided.
  2. Either none or all of the account related information must be provided.
  3. Either none or all of the account related information must be provided.
  4. See note 1
  5. See note 1
  6. See note 1
  7. Either none or all of the product related information must be provided.
  8. See note 6
  9. See note 6
  10. If provided requires all account and product related information to be provided.
  11. Required if default_day_salary is not provided. In which case it is used as the profile default debit order day as well as the product debit order day.
  12. Either none or all of the account related information must be provided.
  13. See note 12
  14. See note 12
  15. See note 12
  16. See note 12
  17. Either none or all of the product related information must be provided.
  18. See note 17
  19. See note 17
  20. If provided requires all account and product related information to be provided.
  21. Required if default_day_salary is not provided. In which case it is used as the company default debit order day as well as the product debit order day.
  22. Required if day_salary is not provided.

Copyright © 2024 SwitchTransact