whatsapp_cloud_server library
WhatsApp Cloud API Server Library
This library provides server-compatible WhatsApp Cloud API integration without Flutter UI dependencies. Perfect for webhook servers and backend applications.
Main differences from the Flutter version:
- Uses in-memory token storage instead of shared_preferences
- Excludes Flutter UI widgets
- Optimized for server/CLI environments
Classes
- AccountEvent
- Represents an account-related event.
- Address
- Contact address information.
- AddressMessage
- Address request message for delivery address collection.
- ApiClient
- Core API client for WhatsApp Cloud API communication.
- AudioMessage
- Audio message for sending audio files via WhatsApp.
- AuthManager
- Manages authentication for the WhatsApp Cloud API.
- BaseResponse
- Base class for all API responses.
- BodyComponent
- Body component for interactive messages.
- Button
- Button component for interactive button messages.
- ButtonActionComponent
- Action component for button-based interactive messages.
- Constants
- Constants used throughout the WhatsApp Cloud API client.
- Contact
- Contact information for WhatsApp messages.
- ContactService
- Service for managing WhatsApp contacts and recipient information.
- CtaUrlMessage
- Interactive Call-To-Action URL message for mapping URLs to buttons.
- CurrencyParameter
- Currency parameter for templates.
- DateTimeParameter
- Date/time parameter for templates.
- DocumentMessage
- Document message for sending files via WhatsApp.
- DocumentParameter
- Document parameter for template headers.
- Email information for a contact.
- EnvironmentConfig
- Environment configuration for different deployment stages.
- Footer component for interactive messages.
- Formatters
- Utility class for formatting data for WhatsApp Cloud API.
- HeaderComponent
- Header component for interactive messages.
- ImageMessage
- Image message for sending images via WhatsApp.
- ImageParameter
- Image parameter for template headers.
- InMemoryTokenStorage
- In-memory token storage implementation for testing.
- InteractiveComponent
- Base class for interactive message components.
- InteractiveMessage
- Interactive message for creating clickable button or list messages.
- InteractiveMessageFactory
- Factory methods for creating common interactive messages.
- ListActionComponent
- Action component for list-based interactive messages.
- LocationMessage
- Location message for sharing geographical coordinates via WhatsApp.
- LocationRequestMessage
- Interactive location request message to request user's location.
- Logger
- Custom logger for the WhatsApp Cloud API client.
- MediaFile
- Represents a media file for WhatsApp Cloud API.
- MediaMessage
- Base class for all media-based message types.
- MediaResponse
- Response from a media operation.
- MediaService
- Service for uploading and managing media for WhatsApp Cloud API.
- Message
- Base class for all WhatsApp message types.
- MessageEvent
- Represents an incoming message event from a user.
- MessageResponse
- Response from sending a message via WhatsApp Cloud API.
- MessageService
- Service for sending various types of messages through WhatsApp Cloud API.
- MessageStatusEvent
- Represents a message status event (delivered, read, failed, etc.).
- Phone
- Phone information for a contact.
- RateLimitConfig
- Rate limiting configuration and enforcement.
- RetryPolicy
- Configuration for retry behavior when API requests fail.
- Row
- Row item for list-based interactive messages.
- Section
- Section for list-based interactive messages.
- SecurityUtils
- Security utilities for WhatsApp Cloud API.
- StatusEvent
- Represents a status update event for a message.
- StickerMessage
- Sticker message for sending stickers via WhatsApp.
- Template
- Message template for WhatsApp Cloud API.
- TemplateBuilder
- Helper class for creating message templates.
- TemplateComponent
- Component of a WhatsApp message template.
- TemplateParameter
- Base class for all template parameters.
- TemplateResponse
- Response from a message template operation.
- TemplateService
- Service for working with WhatsApp message templates.
- TextMessage
- Text message implementation for WhatsApp Cloud API.
- TextParameter
- Text parameter for templates.
- TokenStorage
- Abstract interface for token storage implementations.
- Url
- URL information for a contact.
- Validators
- Utility class for validating WhatsApp-related data.
- VideoMessage
- Video message for sending videos via WhatsApp.
- VideoParameter
- Video parameter for template headers.
- WebhookEvent
- Base class for all webhook events.
- WebhookService
- Service for handling WhatsApp webhook notifications.
- WhatsAppAnalytics
- Analytics and metrics collection for WhatsApp Cloud API usage.
- WhatsAppApiConfig
- Configuration for the WhatsApp Cloud API client.
Enums
- ComponentType
- Types of template components.
- Environment
- Represents the available WhatsApp Cloud API environments.
- InteractiveComponentType
- Interactive message component types.
- InteractiveType
- Types of interactive messages supported by WhatsApp Cloud API.
- LogLevel
- Log levels for controlling verbosity of logging output.
- MediaSource
- Media source options for media messages.
- MediaType
- Supported media types for WhatsApp Cloud API.
- MessageType
- Types of WhatsApp messages supported by the API.
- ParameterType
- Parameter types for template components.
- TemplateStatus
- Status of a WhatsApp message template.
- WebhookNotificationType
- Types of WhatsApp webhook notifications.
Extensions
- MediaTypeExtension on MediaType
- Extension methods for MediaType enum.
Typedefs
- MessageEventHandler = void Function(MessageEvent event)
- Function type for handling message events.
-
RawWebhookHandler
= void Function(Map<
String, dynamic> payload) - Function type for handling raw webhook payloads.
- StatusEventHandler = void Function(StatusEvent event)
- Function type for handling status events.
Exceptions / Errors
- ApiException
- Base exception for all API-related errors.
- AuthException
- Exception thrown when authentication-related errors occur.
- MediaException
- Exception thrown when media-related errors occur.
- MessageException
- Exception thrown when message-related errors occur.
- RateLimitException
- Specialized exception for rate limiting errors.
- WebhookParseException
- Exception thrown when webhook payload parsing fails.