-
Notifications
You must be signed in to change notification settings - Fork 0
Appointment
The appointment entrypoints allow users to create and update appointments.
The appointment model has the following attributes:
[
"id" => int
"contact_id" => int,
"description" => string,
"end_date" => datetime,
"location" => string,
"remind_time" => int, // see below for valid values
"start_date" => datetime,
"title" => string
"user_id" => int
]
The remind_time
are values in minutes before start_date
to show a pop-up reminder. The only acceptable values are 5, 10, 15, 30, 60, 120, 240, 480, 1440, 2880.
The method list
retrieves a list of all the tasks for the authenticated user. This is currently valid only for Keap Max Classic users.
use KeapGeek\Keap\Facades\Keap;
Keap::appointment()->list([
'contact_id' => ?int,
'limit' => ?int,
'offset' => ?int,
'since' => ?string,
'until' => ?string
]);
This method accepts different optional parameters, to query on:
-
contact_id
is the contact id of the contact. -
limit
is the amount of appointments to return, it defaults to 1000. -
offset
is the first item that starts the set, it defaults to 0. -
since
is the date to start searching from. -
until
is the date to end searching to.
It returns an array with all the appointments that fullfill the criteria.
You can input any Carbon parsable string in the date fields, since they will automatically be converted into timestamps using Carbon::parse.
The method count
returns the count of items in the query.
use KeapGeek\Keap\Facades\Keap;
Keap::appointment()->count([
'contact_id' => ?int,
'limit' => ?int,
'offset' => ?int,
'since' => ?string,
'until' => ?string
]);
Same as for the list, this method accepts optional parameters, to query on.
It returns an integer.
The method create
creates a Appointment for a given contact. It must contain at least one item in title
or due_date
all the other attributes are optional.
use KeapGeek\Keap\Facades\Keap;
Keap::appointment()->create([
'contact_id' => ?int,
'description' => ?string,
'end_date' => string, // required
'location' => ?string,
'remind_time' => ?int, //see description for acceptable values
'start_date' => string, // required
'title' => string, // required
'user_id' = ?int,
]);
You can input any Carbon parsable string in the date fields, since they will automatically be converted into timestamps using Carbon::parse.
All fields that are preceded by '?' are optional, and must not be included to make a successful request.
The remind time is the value in minutes before start_date to show a reminder. The acceptable values are 5, 10, 15, 30, 60, 120, 240, 480, 1440, 2880.
If a user is specified via user_id, he will be notified.
This method will return the appointment model, with a appointment id, and created and updated timestamps.
This method retrieves a specific appointment with respect to user permissions. The authenticated user will need the "can view all records" permission for the appointment.
use KeapGeek\Keap\Facades\Keap;
Keap::appointment()->find($appointment_id);
This method returns the appointment model or null if not found.
The method replace
replaces completely the existing appointment. It will updated all the submitted fields and replace the other with the default values.
use KeapGeek\Keap\Facades\Keap;
Keap::appointment()->replace($appointment_id, [
'contact_id' => ?int,
'description' => ?string,
'end_date' => ?string, //required
'location' => ?string,
'remind_time' => ?int,
'start_date' => ?string, //required
'title' => ?string, //required
'user_id' = ?int,
]);
The title
, start_date
and end_date
are required, all the other attributes are optional.
This method returns the updated apointment model.
You can input any Carbon parsable string in the date fields, since they will automatically be converted into timestamps using Carbon::parse.
The method update
updates the appointment, where the input data is given as in the format for the create method.
use KeapGeek\Keap\Facades\Keap;
Keap::appointment()->replace($appointment_id, [
'contact_id' => ?int,
'description' => ?string,
'end_date' => ?string, //required
'location' => ?string,
'remind_time' => ?int,
'start_date' => ?string, //required
'title' => ?string, //required
'user_id' = ?int,
]);
The title
, start_date
and end_date
are required, all the other attributes are optional.
This method returns the updated apointment model.
You can input any Carbon parsable string in the date fields, since they will automatically be converted into timestamps using Carbon::parse.
The delete
method allows to delete an appointment given its id.
use KeapGeek\Keap\Facades\Keap;
Keap::appointment()->delete($appointment_id);
This method returns true, if the appointment has been deleted, or null if not found.
The method model
retrieves information about the custom fields and properties on the Keap appointment model.
use KeapGeek\Keap\Facades\Keap;
Keap::contact()->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 appointment properties. Each element in this array is itself an array that includes all options and values configured, depending on the type of field selected.