YCLIENTS integration for online booking on website

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    848
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

YCLIENTS integration for online booking on a website

YCLIENTS is a Russian platform for managing appointments and business in the service sector (beauty salons, medicine, fitness). Provides a booking widget and API for integrating with external websites.

Embedding the YCLIENTS widget

<!-- Standard widget -->
<script src="https://widgetv3.yclients.com/widgetJS.js" charset="UTF-8"></script>
<a
  class="yclients-wr-button"
  target="_blank"
  href="https://n123456.yclients.com"
  data-company-id="123456"
  data-source-id="your_source_id"
>
  Book online
</a>

The widget opens in a popup window above the page.

YCLIENTS API v2

API requires an authorization token. Get via Basic Auth with account login/password:

class YclientsApiClient
{
    private string $token;
    private int    $companyId;

    public function authenticate(string $login, string $password): void
    {
        $resp = Http::withHeaders([
            'Authorization' => 'Bearer ' . config('yclients.app_token'),
        ])->post('https://api.yclients.com/api/v1/auth', [
            'login'    => $login,
            'password' => $password,
        ]);

        $this->token = $resp->json('data.user_token');
    }

    public function getBookings(string $startDate, string $endDate): array
    {
        return Http::withHeaders([
            'Authorization' => "Bearer {$this->token}, User {$this->token}",
            'Accept'        => 'application/vnd.yclients.v2+json',
        ])->get("https://api.yclients.com/api/v1/records/{$this->companyId}", [
            'start_date' => $startDate,
            'end_date'   => $endDate,
        ])->json('data');
    }

    public function createBooking(array $data): array
    {
        return Http::withHeaders([
            'Authorization' => "Bearer {$this->token}, User {$this->token}",
        ])->post("https://api.yclients.com/api/v1/book_record/{$this->companyId}", $data)
          ->json('data');
    }
}

Data synchronization

YCLIENTS does not provide push-webhooks in the basic plan. Get data on new bookings via polling:

// Check for new bookings every 5 minutes
$schedule->call(function () {
    $newBookings = app(YclientsApiClient::class)
        ->getBookings(now()->toDateString(), now()->addDay()->toDateString());

    foreach ($newBookings as $booking) {
        YclientsBooking::updateOrCreate(
            ['yclients_id' => $booking['id']],
            [
                'client_name'  => $booking['client']['name'],
                'client_phone' => $booking['client']['phone'],
                'service'      => $booking['services'][0]['title'] ?? null,
                'starts_at'    => $booking['date'],
                'staff_name'   => $booking['staff']['name'] ?? null,
            ]
        );
    }
})->everyFiveMinutes();

Timeline

Embedding the widget and basic API synchronization: 2–4 working days.