Download the PHP package raaabdullah1/meta-graph-errors without Composer
On this page you can find all versions of the php package raaabdullah1/meta-graph-errors. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package meta-graph-errors
meta-graph-errors
Meta's Graph API, Instagram, Messenger and WhatsApp Cloud API return numeric error codes that are reused across products and often unhelpful. This library maps them to something your code can act on: what kind of failure it is, whether retrying can help, and what to do next.
Install
Requires PHP 8.1 or newer. No other dependencies.
Laravel example
What you get back
classify() and fromResponse() return a Classification:
| Field | Type | Meaning |
|---|---|---|
category |
ErrorCategory |
Authentication, ProviderPermission, RateLimit, Validation, PolicyViolation, ResourceState, Transient, Unknown |
retryability |
Retryability |
Retryable, RetryableWithBackoff, RequiresUserAction, RequiresReconnect, RequiresProviderAction, NotRetryable, Unknown |
recovery |
RecoveryAction |
the primary corrective step, such as Reconnect, AdjustRequest, Wait |
confidence |
Confidence |
High, Medium or Low |
hint |
string |
a short explanation |
matchedBy |
string |
pair, subcode, code, transient_flag or none |
product, source |
?string |
which Meta product the row is about, and where the meaning came from |
Helpers: isRetryable(), shouldBackOff(), requiresReconnect(), isKnown(), toArray().
How matching works
Meta reuses error codes across products, so matching goes from most to least specific:
- the exact
(code, error_subcode)pair, such as190:463(token expired) - the
error_subcodealone, such as2534022(Instagram messaging window closed) - the
codealone, such as613(rate limit) - Meta's own
is_transientflag, if nothing above matched - otherwise
UnknownatLowconfidence
It never guesses from a message string. An error it doesn't recognise comes back as unknown, so you can tell "we know this" from "we don't".
Coverage
109 catalogued rows covering the Graph API OAuth and permission errors, Pages publishing, Instagram media and publishing limits, Messenger and Instagram messaging windows, WhatsApp Cloud API send, template and media errors, Ads and Catalog rate limits, Facebook Live eligibility and Creator Marketplace validation. Each row has a source label naming the documentation area it came from, or observed when it was seen in real API responses rather than documented.
Meta adds and changes error codes without notice. If you hit one that is missing or wrong, please open an issue or a PR with a link to Meta's documentation or a sample response.
Development
License
MIT