Mex feature provides access to WhatsApp’s Meta Exchange (MEX) GraphQL API, enabling queries and mutations for advanced operations.
Access
Access MEX operations through the client:Methods
query
Execute a GraphQL query.request- AMexRequestcontaining the document ID and variables
MexResponse- The GraphQL response with data and/or errors
mutate
Execute a GraphQL mutation.request- AMexRequestcontaining the document ID and variables
MexResponse- The GraphQL response with data and/or errors
Types
MexRequest
Request structure for GraphQL operations.MexResponse
Response from a GraphQL operation.has_data()- Returnstrueif response contains datahas_errors()- Returnstrueif response contains errorsfatal_error()- Returns the first fatal error, if any
MexGraphQLError
GraphQL error structure.error_code()- Returns the error code if availableis_fatal()- Returnstrueif this is a fatal error
MexErrorExtensions
Additional error metadata.Error handling
TheMexError enum covers all possible error cases: