HTTP response code 427 indicates that a Flow token is no longer valid, preventing further actions in the current session. This usually happens when a user attempts to continue a session that has already been completed or is no longer recognized by the server.

Causes of HTTP 427 Error

This error can occur due to several reasons:

  1. Expired Flow Token: The token used for the Flow session has exceeded its validity period.

  2. Completed Flow: The user has already completed the Flow, and the token cannot be reused.

  3. Server-Side Invalidations: The server may have invalidated the token due to business logic, such as preventing users from initiating the same Flow again.

  4. Session Timeout: If the Flow has a predefined session timeout, an expired token can trigger this error.

Client-Side Behavior

When an HTTP 427 error occurs, the following behavior is expected on the client side:

  • A generic error message is displayed to the user.

  • The conversation CTA (Call-to-Action) button is disabled, preventing the user from continuing the Flow.

  • The server can send a new message to the user, generating a fresh Flow token.

A custom error message can be displayed to the user, such as:
HTTP/2 427
content-type: application/json
content-length: 51
date: Wed, 06 Jul 2022 14:03:03 GMT
{“error_msg”: “The order has already been placed”}

How to Fix HTTP 427 Errors

To resolve this error, follow these steps:

  1. Generate a New Flow Token: If the user needs to restart the Flow, send a new message that generates a fresh token.

  2. Check Flow Completion Status: Ensure that users are not trying to reinitiate a completed Flow unless intended.

  3. Customize the Error Message: Provide a clear and actionable error message to users instead of a generic failure message.

  4. Handle Token Expiration Optimally: Implement logic to refresh the token if needed or guide users on the next steps.

For additional details, refer to the documentation on Implementing Endpoints for Flows to manage token validation effectively. For more troubleshooting insights related to Whatsapp Business API, check out heltar.com/blogs.