-
Notifications
You must be signed in to change notification settings - Fork 0
Company
These entry points allow you to create or update a company model. The company model has as only required field the company_name
. As for the contacts, it has phone_numbers, and email_address, and eventually custom fields and fax_numbers.
The company model has the following attributes:
[
"id" => int
"company_name" => string
"phone_number" => [string]
"website" => ?string
"email_address" => ?string
"email_status" => string
"email_opted_in" => bool
"address" => [string]
]
The phone number and address are optional fields and contain an array with all the subproperties of the phone number and address.
The 3 email_* fields are related to the marketable status of the email address. If opted_in is true, you can market to that email address, otherwise Keap will prevent you from sending email.
The email status is a string of different possible values:
UnengagedMarketable, SingleOptIn, DoubleOptin, Confirmed, UnengagedNonMarketable, NonMarketable, Lockdown, Bounce, HardBounce, Manual, Admin, System, ListUnsubscribe, Feedback, Spam, Invalid, Deactivated.
The method list
retrieves a list of all the companies.
use KeapGeek\Keap\Facades\Keap;
Keap::company()->list([
'company_name' => ?string,
'limit' => ?integer,
'offset' => ?integer,
'optional_properties' => ?[string],
'order' => ?string,
'order_direction' => ?string,
]);
This method accepts different optional parameters to query on:
-
company_name
is the name of the company -
limit
is the amount of companies to return, it defaults to 1000. -
offset
is the first item that starts the set, it defaults to 0. -
optional_properties
are other company properties that are not returned by default, such asnotes
,fax_number
andcustom_fields
. -
order
is the attribute to order items by, it can beid
,date_created
,name
oremail
. -
order_direction
can beASCENDING
orDESCENDING
.
It returns an array with all the retrieved Company Models.
The method count
returns the count of items in the query.
use KeapGeek\Keap\Facades\Keap;
Keap::company()->count([
'company_name' => ?string,
]);
As for the list method, it accepts an optional parameter to query on:
-
company_name
is the name of the company
The create
method creates a new company. The only required field is the company_name
.
use KeapGeek\Keap\Facades\Keap;
Keap::company()->create([
'company_name' => string, //required,
'email_address' => ?string,
'opt_in_reason' => ?string,
'address' => [?string],
'phone_number' => [?string],
'fax_number' => [?string],
'custom_fields' => [?string],
'notes' => ?string,
'website' => ?string,
]);
If the company name is already present, it will return the existing model.
The email address is optional, when inserted alone, it will result in a NonMarketable status and opted in of false. To solve this problem, Laravel Keap automatically insert in all requests a default opt_in_reason
, that can be found in the Config File (here to the doc page).
The create method returns the newly created company model.
The update
method updates the fields of an existing company, given the company_id
. The only required field is the company_name
.
use KeapGeek\Keap\Facades\Keap;
Keap::company()->update($company_id, [
'company_name' => string, //required,
'email_address' => ?string,
'opt_in_reason' => ?string,
'address' => [?string],
'phone_number' => [?string],
'fax_number' => [?string],
'custom_fields' => [?string],
'notes' => ?string,
'website' => ?string,
]);
The same rules for the email address of the create method apply here.
The update method returns the updated company model.
The find
method retrieves the company model, given the company_id
.
use KeapGeek\Keap\Facades\Keap;
Keap::company()->find($company_id, [
'fax_number',
'custom_fields',
'notes',
]);
The find method has two arguments, the first is the id of the company, and the second, which is optional, is an array of additional fields that can be retrieved via Keap.
If these fields are not provided, Keap will return the Company model without these additional fields.
The method model
retrieves information about the custom fields and properties on the Keap company model.
use KeapGeek\Keap\Facades\Keap;
Keap::company()->model();
This method will return two arrays:
[
"custom_fields" => [
...
],
"optional_properties" => [string],
]
The response includes an array of custom fields, each representing a custom property set in your Keap dashboard. If these custom fields are configured, the response will return an array containing all custom company properties. Each element in this array is itself an array that includes all options and values configured, depending on the type of field selected.