Download the PHP package multiwa/multiwa-php without Composer

On this page you can find all versions of the php package multiwa/multiwa-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package multiwa-php

MultiWA PHP SDK

Official PHP SDK for MultiWA, the self-hosted WhatsApp API gateway with a built-in team inbox.

Requirements

Installation

To try a change that is not released yet, install from a clone of the MultiWA repository with a Composer path repository:

Quick start

The constructor also takes timeout (seconds, default 30) and handler, a Guzzle handler for tests (see Testing your code).

Messages

to is a phone number with country code (6281234567890; +, spaces and dashes are fine) or a WhatsApp JID (…@s.whatsapp.net, …@c.us, a group …@g.us). Media goes by public url or by base64.

Every send returns a MultiWA\Models\MessageResult:

Property
success false when sending failed; error says why
messageId MultiWA's id of the stored message, the one sendReaction() takes
conversationId
status sent, queued (a worker sends it) or failed
waMessageId WhatsApp's id of the message once WhatsApp accepted it (null while queued); WebSocket message:ack events use this id
error

Contacts

Broadcasts

A broadcast is created as a draft and sends only when you start or schedule it. The profile's send limits pace it.

Profiles

A profile is one WhatsApp number.

Linking a number (QR code)

The QR code is not part of the REST API: it is pushed as the qr:update event of the WebSocket API. A Socket.IO client connects to https://your-multiwa-instance.com/ws with the API key, emits join with the profile id, and shows each event's qrCode (a data:image/png;base64,… URL) until it is scanned. The event reaches owners and admins only: a dashboard sign-in of one qualifies, and so does an API key of one with profiles:write (or no scope list). You can also scan it in the admin dashboard. Afterwards status() reports connected. A profile that is already linked answers ['status' => 'already_connected', …].

Webhooks

create() and update() also take headers, extra headers sent with every delivery (['X-Tenant' => 'acme']).

Calls

$client->calls() is in SDK 1.4.0 and later.

Incoming WhatsApp calls: the follow-up queue, the readiness of answering them in the dashboard, the recordings and the announcement (Calls answered in the dashboard).

Every calls method is in the PHP SDK guide. An API key acts with its user's role, and a key with a scope list needs the scopes in API keys. With Guzzle's cURL handler, the default, the client's timeout covers a whole download: a long recording may need a larger one. A refused setting throws an ApiException (409); getResponseBody()['reasons'] says why. Answering is for people signed in to the dashboard: follow calls with the call.* webhooks, or the WebSocket call:update event.

Other routes

request() calls any route of the REST API with the same authentication and error handling, and returns the decoded JSON:

Errors

Everything the SDK throws extends MultiWA\Exceptions\MultiWAException:

Exception Thrown for Adds
MultiWAException No response (connection failed, timeout) or a success that is not JSON
ApiException Any 4xx or 5xx, e.g. 409 PROFILE_DISCONNECTED (sent while the profile is offline) getStatusCode(), getErrorCode(), getResponseBody()
ValidationException 400, 422 getErrors(): the validation messages
AuthenticationException 401 (bad or missing API key), 403 (not allowed, or not in your organization)
NotFoundException 404
RateLimitException 429 getRetryAt()

The four specific ones extend ApiException. getErrorCode() returns the API's machine-readable code when it sends one (PROFILE_DISCONNECTED, DAILY_LIMIT_REACHED, OTP_DELIVERY_FAILED, …), else null. A resource of another organization, or one that does not exist, usually answers 403: the API does not reveal which.

A 429 is the send gate protecting the number. Its code says which limit:

getErrorCode() Meaning getRetryAt()
DAILY_LIMIT_REACHED The profile's daily cap When the counter resets
COLD_DAILY_LIMIT_REACHED The cap for messages to chats that have not written to the number within the service window (24 hours by default) When the counter resets
COLD_CIRCUIT_OPEN Those messages are paused after repeated failed deliveries When they resume
REPEAT_SUPPRESSED The same text to the same chat moments ago When it may be sent again
null Too many API requests per minute null

Testing your code

Pass a Guzzle handler as the last constructor argument to answer requests without a server:

Development

The tests check every call against the API's route list (scripts/api-routes.snapshot.json), so run them inside the MultiWA repository; elsewhere that check is skipped.

License

MIT, see LICENSE.


All versions of multiwa-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package multiwa/multiwa-php contains the following files

Loading the files please wait ...