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(1y ago)027[4 PRs](https://github.com/onuraycicek/laravel-whatsapp-cloud-api/pulls)MITPHPPHP ^8.0|^8.1|^8.2CI passing

Since Jun 1Pushed 1mo 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 1mo ago

READMEChangelogDependencies (12)Versions (11)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

34

—

LowBetter than 77% of packages

Maintenance64

Regular maintenance activity

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

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

690d ago

PHP version history (2 changes)0.0.1PHP ^8.2

0.0.2PHP ^8.0|^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d24ddfe49acb9e8760950e4995be3fdab48c9fbd14214cc805dee2f3d5f59472?d=identicon)[onuraycicek](/maintainers/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

[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)[njoguamos/laravel-plausible

A laravel package for interacting with plausible analytics api.

208.8k](/packages/njoguamos-laravel-plausible)[likeabas/filament-chatgpt-agent

Integrate with OpenAI ChatGPT

235.3k](/packages/likeabas-filament-chatgpt-agent)

PHPackages © 2026

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