PHPackages                             onuraycicek/laravel-whatsapp-cloud-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. onuraycicek/laravel-whatsapp-cloud-api

ActiveLibrary[API Development](/categories/api)

onuraycicek/laravel-whatsapp-cloud-api
======================================

This is my package laravel-whatsapp-cloud-api

0.0.6(2y ago)027[4 PRs](https://github.com/onuraycicek/laravel-whatsapp-cloud-api/pulls)MITPHPPHP ^8.0|^8.1|^8.2CI passing

Since Jun 1Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/onuraycicek/laravel-whatsapp-cloud-api)[ Packagist](https://packagist.org/packages/onuraycicek/laravel-whatsapp-cloud-api)[ Docs](https://github.com/onuraycicek/laravel-whatsapp-cloud-api)[ GitHub Sponsors](https://github.com/Onuraycicek)[ RSS](/packages/onuraycicek-laravel-whatsapp-cloud-api/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (12)Versions (12)Used By (0)

WCA Package ReadMe
==================

[](#wca-package-readme)

Introduction
------------

[](#introduction)

This package is designed to facilitate interactions with the WCA API, providing functionality for handling business profiles, uploading and sending media, and managing phone numbers. You can see the demo application by running the laravel project in the **example** folder.

Installation
------------

[](#installation)

To install the WCA package, use the following composer command:

```
composer require onuraycicek/laravel-whatsapp-cloud-api
```

Configuration
-------------

[](#configuration)

Before using the package, ensure that you have the following environment variables set in your .env file:

```
WCA_BUSINESS_ID=your_business_id
WCA_ACCESS_TOKEN=your_whatsapp_access_token
//optional
WCA_FROM_PHONE_NUMBER_ID=your_from_phone_number_id
WCA_TARGET_PHONE_NUMBER=your_target_phone_number
DEFAULT_GRAPH_VERSION=v19.0
```

Usage
-----

[](#usage)

### Business Profile

[](#business-profile)

To retrieve the business profile information:

```
try {
    $wca = new WCA\WCA\WCA([
        'from_phone_number_id' => $request->from_phone_number_id ?? env('WCA_FROM_PHONE_NUMBER_ID'),
        'business_id' => env('WCA_BUSINESS_ID'),
    ]);

    $response = $wca->businessProfile("about,address,description,email,profile_picture_url,websites,vertical");
    $data = $response->decodedBody()["data"][0];
} catch (\Throwable $th) {
    if (json_decode($th->getMessage())) {
        return json_decode($th->getMessage())->error->message;
    }
    return $th->getMessage();
}
```

### Upload and Send Media

[](#upload-and-send-media)

To upload and send media:

```
    try {
        $wca = new WCA\WCA\WCA([
            'from_phone_number_id' => $request->from_phone_number_id ?? env('WCA_FROM_PHONE_NUMBER_ID'),
            'business_id' => env('WCA_BUSINESS_ID'),
        ]);

        if ($request->has("file")) {
            $uploadedFiles = [];
            //upload
            foreach ($request->file as $file) {
                // save file temporarily random name
                $randomName = Str::random(10);
                $tempName = $randomName . '.' . $file->getClientOriginalExtension();
                $file->storeAs('temp', $tempName);
                $response = $wca->uploadMedia(
                    storage_path('app/temp/' . $tempName)
                );
                $id = $response->decodedBody()["id"];
                $uploadedFiles[] = [
                    "id" => new MediaObjectID($id),
                    "name" => $file->getClientOriginalName(),
                    "temp_name" => $tempName,
                ];
            }

            // send
            foreach ($uploadedFiles as $key => $file) {
                $caption = $key == 0 ? $request->message : null; // send caption only first file
                $response = $wca->sendDocument(
                    to: $request->to_phone_number ?? env("WCA_TARGET_PHONE_NUMBER"),
                    document_id: $file["id"],
                    name: $file["name"],
                    caption: $caption
                );
            }

            // remove temporary files
            foreach ($uploadedFiles as $file) {
                unlink(storage_path('app/temp/' . $file["temp_name"]));
            }

            return $response->body();
        } else {
            $response = $wca->sendTextMessage(
                to: $request->to_phone_number ?? env("WCA_TARGET_PHONE_NUMBER"),
                text: $request->message
            );
        }

        return $response->body();
    } catch (\Throwable $th) {
        if (method_exists($th, 'getMessage') && json_decode($th->getMessage())) {
            return json_decode($th->getMessage())->error->message;
        }
        return $th;
    }
```

### Retrieve Business Phone Numbers

[](#retrieve-business-phone-numbers)

To retrieve the business phone numbers:

```
try {
    $wca = new WCA\WCA\WCA([
        'from_phone_number_id' => env('WCA_FROM_PHONE_NUMBER_ID'),
        'business_id' => env('WCA_BUSINESS_ID'),
    ]);

    $response = $wca->getBusinessPhoneNumbers();
    $data = $response->decodedBody()["data"];
} catch (\Throwable $th) {
    if (json_decode($th->getMessage())) {
        return json_decode($th->getMessage())->error->message;
    }
    return $th->getMessage();
}
```

Error Handling
--------------

[](#error-handling)

The package includes error handling to catch and return meaningful messages when exceptions occur. When an error occurs, the message is decoded and returned if it is a JSON object; otherwise, the raw message is returned.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance56

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

6

Last Release

737d ago

PHP version history (2 changes)0.0.1PHP ^8.2

0.0.2PHP ^8.0|^8.1|^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/87834696?v=4)[Onur Ayçiçek](/maintainers/onuraycicek)[@onuraycicek](https://github.com/onuraycicek)

---

Top Contributors

[![onuraycicek](https://avatars.githubusercontent.com/u/87834696?v=4)](https://github.com/onuraycicek "onuraycicek (16 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

laravelonurayciceklaravel-whatsapp-cloud-api

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/onuraycicek-laravel-whatsapp-cloud-api/health.svg)

```
[![Health](https://phpackages.com/badges/onuraycicek-laravel-whatsapp-cloud-api/health.svg)](https://phpackages.com/packages/onuraycicek-laravel-whatsapp-cloud-api)
```

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M102](/packages/dedoc-scramble)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

811334.1k3](/packages/defstudio-telegraph)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)[lettermint/lettermint-laravel

Official Lettermint driver for Laravel

1190.2k1](/packages/lettermint-lettermint-laravel)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1123.7k](/packages/codebar-ag-laravel-docuware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
