Skip to main content

WhatsApp: number, analytics and Flows

Tools for the WhatsApp Business number connected to a profile, besides sending and reading messages: block users, set the commands and ice breakers people see when they open the chat, check the number's quality and messaging limit, change its display name or PIN, read messaging, pricing and template analytics, and build WhatsApp Flows (forms inside the chat).

  • Authentication: API Key — Authorization: Apikey <YOUR_API_KEY>
  • Every call takes user, the profile username that has the WhatsApp number connected (query string on GET and DELETE, JSON body otherwise).
  • Everything is read from and written to Meta live, for the profile's own WhatsApp Business account.

Block users​

GET    /api/uploadposts/dms/whatsapp/blocked?user=my-profile[&limit=100][&after=][&before=]
POST /api/uploadposts/dms/whatsapp/blocked {"user": "my-profile", "users": ["34600111222"]}
DELETE /api/uploadposts/dms/whatsapp/blocked {"user": "my-profile", "users": ["34600111222"]}

A blocked user cannot write to the number, and the number cannot write to them. POST blocks up to 1,000 users that messaged the number in the last 24 hours; DELETE unblocks up to 1,000. users are phone numbers in international format or WhatsApp user ids (US.1349...).

{ "success": true, "blocked": [ { "input": "34600111222", "wa_id": "34600111222" } ], "failed": [] }

DELETE answers unblocked instead of blocked. Users WhatsApp could not block or unblock come in failed with the reason. GET lists them as blocked: [{wa_id, user_id}], paged with the after / before cursors of paging.

Commands and ice breakers​

GET  /api/uploadposts/dms/whatsapp/automation?user=my-profile
POST /api/uploadposts/dms/whatsapp/automation

Commands are the / shortcuts people can type in the chat; ice breakers (prompts) are the questions offered when someone opens it for the first time. POST replaces either list (send only the one you want to change; an empty list clears it).

FieldDescription
commandsUp to 30 {command_name, command_description}: name up to 32 characters, description (the hint) up to 256.
promptsUp to 4 ice breaker texts.
curl -X POST https://api.upload-post.com/api/uploadposts/dms/whatsapp/automation \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{
"user": "my-profile",
"commands": [ { "command_name": "track", "command_description": "Track your order" } ],
"prompts": ["Where is my order?", "Do you ship abroad?"]
}'
{ "success": true, "commands": [ { "command_name": "track", "command_description": "Track your order" } ], "prompts": ["Where is my order?", "Do you ship abroad?"] }

A command arrives as a normal text message (/track).

Number: quality, limit, display name and PIN​

GET  /api/uploadposts/dms/whatsapp/number?user=my-profile
POST /api/uploadposts/dms/whatsapp/number

GET answers the state of the number as Meta has it:

{
"success": true,
"number": {
"display_phone_number": "+34 600 999 888",
"verified_name": "Acme Store",
"quality_rating": "GREEN",
"messaging_limit_tier": "TIER_1K",
"throughput": { "level": "STANDARD" },
"name_status": "APPROVED",
"code_verification_status": "VERIFIED",
"status": "CONNECTED",
"is_official_business_account": false,
"platform_type": "CLOUD_API"
}
}

quality_rating (GREEN, YELLOW, RED) is how WhatsApp rates the messages of the number, and messaging_limit_tier how many people it can start conversations with per day. While a new display name is in review, new_display_name and new_name_status show it.

POST takes an action:

actionFieldsWhat it does
request_display_namedisplay_nameAsks Meta to review a new display name.
apply_display_name—Once Meta approved it, registers the number again with its PIN so the new name is shown.
change_pinpin (6 digits), confirm: trueChanges the two-step verification PIN. It cannot be turned off through the API.

The answer is the number as above, after the change.

Analytics​

GET /api/uploadposts/dms/whatsapp/analytics?user=my-profile&type=messaging&start=1793404800&end=1794009600&granularity=DAY
ParameterDescription
typemessaging (messages sent and delivered per period), pricing (volume and cost per category) or templates (per template, daily, last 90 days).
start, endUnix seconds.
granularitymessaging: HALF_HOUR, DAY or MONTH. pricing: HALF_HOUR, DAILY or MONTHLY.
country_codesComma-separated ISO country codes.
dimensions, metric_typespricing: Meta's dimensions, and COST and/or VOLUME.
template_idstemplates: up to 10 template ids, comma-separated.
this_number_onlytrue: only the profile's number, not the whole WhatsApp Business account.

The answer carries type and Meta's figures as they come (analytics, or data with paging for templates).

Template analytics have to be switched on once for the WhatsApp Business account:

curl -X POST https://api.upload-post.com/api/uploadposts/dms/whatsapp/analytics \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{"user": "my-profile", "action": "enable_template_insights", "confirm": true}'
{ "success": true, "template_insights_enabled": true }

Meta does not let template analytics be turned off again.

Flows​

WhatsApp Flows are forms inside the chat (sign-ups, bookings, surveys...). Build them here, then send them with flow on Send a Message.

Method and pathWhat it does
GET /api/uploadposts/dms/whatsapp/flowsThe Flows of the WhatsApp Business account (flows, paged with paging).
POST /api/uploadposts/dms/whatsapp/flowsCreates a Flow: name, categories (SIGN_UP, SIGN_IN, APPOINTMENT_BOOKING, LEAD_GENERATION, CONTACT_US, CUSTOMER_SUPPORT, SURVEY, OTHER), optional flow_json (object or string, up to 10 MB) and publish: true to publish it at once, clone_flow_id, endpoint_uri.
GET /api/uploadposts/dms/whatsapp/flows/{flow_id}Details, health and a preview link.
POST /api/uploadposts/dms/whatsapp/flows/{flow_id}Changes name, categories or endpoint_uri.
GET /api/uploadposts/dms/whatsapp/flows/{flow_id}/jsonThe Flow's assets, each with a download_url.
POST /api/uploadposts/dms/whatsapp/flows/{flow_id}/jsonReplaces the Flow JSON: flow_json in the body, or a flow.json file as multipart file.
POST /api/uploadposts/dms/whatsapp/flows/{flow_id}/publishPublishes it. Every validation error must be fixed first.
POST /api/uploadposts/dms/whatsapp/flows/{flow_id}/deprecateA published Flow cannot be edited or deleted, only deprecated (confirm: true).
DELETE /api/uploadposts/dms/whatsapp/flows/{flow_id}?user=my-profile&confirm=trueDeletes a draft.
curl -X POST https://api.upload-post.com/api/uploadposts/dms/whatsapp/flows \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{"user": "my-profile", "name": "table_booking", "categories": ["APPOINTMENT_BOOKING"]}'
{ "success": true, "flow": { "id": "1187654321098765", "validation_errors": [] } }

Uploading the Flow JSON answers flow_id and Meta's validation_errors; publishing answers {"flow_id": "...", "published": true}, deprecating deprecated: true and deleting deleted: true.

Errors​

Statuserror_codeMeaning
400whatsapp_invalid_request, confirmation_requiredInvalid request, or a change that needs confirm: true.
400whatsapp_not_connectedThe profile has no WhatsApp number connected.
400whatsapp_api_errorWhatsApp refused the request; meta_error_code carries Meta's code.
401whatsapp_reauth_requiredReconnect the WhatsApp number.
502whatsapp_unreachableMeta did not answer, or failed.