Posts tagged with whatsapp

I recently started using the new Whatsapp Cloud API. Unfortunately already the sample request in the first steps guide gives an error message. The request to the messages endpoint gives the following response:

{   "error": {     "message": "An unknown error occurred",     "type": "OAuthException",     "code": 1,     "error_subcode": 2593006,     "is_transient": false,     "error_user_title": "Account Not Exist",     "error_user_msg": "Account does not exist in Facebook Hosted API, please use /register API to create an account first.",     "fbtrace_id": "AX1Thf9OPBhmj7NlDV6-5IA "   } } 

I am still using the Test WhatsApp Business Account with a Test Number. When calling the register endpoint I get You can’t complete the setup process because your business doesn’t meet WhatsApp’s policy requirements. If you think this is incorrect, reach out to Meta Business Suite support for help.

Does anyone have an idea, what the problem is?

Thank you in advance,

Sören

I'm trying to get WhatsApp's Cloud API working. I managed to set up Meta Business Account and configure a WhatsApp app. Then I configured a webhook and subscribed to messages event (see the following screenshot).

I then managed to send a message via the API using the following request:

curl -i -X POST `   https://graph.facebook.com/v13.0/103690452403982/messages `   -H 'Authorization: Bearer MY_TOKEN' `   -H 'Content-Type: application/json' `   -d '{ \"messaging_product\": \"whatsapp\", \"to\": \"MY_NUMBER\", \"type\": \"template\", \"template\": { \"name\": \"hello_world\", \"language\": { \"code\": \"en_US\" } } }' 

I received the message and it came through the webhook as well. If I reply to that message, it comes through the webhook too.

The problem

However, when I send a message to the associated number from a different WhatsApp number (not via the API) it is received but the webhook is not called.

I suspect some incorrect configuration on my side. When I text the number from a different phone, the chat has a notice about E2E encryption - something which is not present in a chat window of the API-sent message. I assume that E2E-encrypted messages cannot be passed to the webhook because only the recipients should be able to decrypt the message.

Any ideas what I might be missing?

Thank you in advance

Here's what I've done. I'm using Python programming language.

res = requests.put(     url='https://graph.facebook.com/v13.0/messages/wamid.HBgMOTE4NzgwNDk1ODA0FQIAEhggQkU2OURGQUYyMzdCNDlBRkQ1QUI4RERBNDdENDBBOEIA',      header = {         "Authorization": "Bearer my-auth-token",         "Content-Type": "application/json"     },      data=json.dumps({"status": "read"}) ) print(res.json()) 

Output:

{'error': {'message': 'Unknown path components: /wamid.HBgMOTE4NzgwNDk1ODA0FQIAEhggQkU2OURGQUYyMzdCNDlBRkQ1QUI4RERBNDdENDBBOEIA', 'type': 'OAuthException', 'code': 2500, 'fbtrace_id': 'A6f8nCvHOSXSZcAGmevCGeJ'}} 

Can someone please clarify which is the correct WhatsApp Business Account ID to use to access the WhatsApp cloud API?

I have properly set up my webhook and can receive messages. However when I try to send a message using the WhatsApp Business Account ID (marked as number 1 in the attached image) provided here, I get the following error:

error: {     message:       "Unsupported post request. Object with ID '< my app id>' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",     type: "GraphMethodException",     code: 100,     error_subcode: 33,     fbtrace_id: "AQXqjuSJKTWBnyJdUK_W-jj", },  

However when I switch to the second WhatsApp Business Account ID in the curl command (marked as number 2 in the attached image), it works.

What confuses me is that the incoming message has the first WhatsApp Business Account ID (marked number 1 in the attached image) like so:

message: {   object: "whatsapp_business_account",   entry: [     {       id: "xxxxxxxxxxxxxxx",  // This matches the first       changes: [           ...       ],     },   ], }; 

I am using the current api v14.0. Is there some setting I need to change?

I'm using WhatsApp Cloud API Integration for our company use case and all functionality will be server-to-server API call and I have to generate a Permanent token to call the WhatsApp API to send the message. I have submitted a request to get advance access to whatsapp_business_messaging but it got rejected as we do not have any frontend UI to showcase the implementation. Facebook support team said I do not need advance access if we are implementing WhatsApp API for our own use case. We have also generated the permanent key by creating a system user from the Facebook Business dashboard but the API throws an error that this key does not have permission.

Please guide me on how can a get approval or get a permanent access token to use the WhatsApp Cloud API Integration.

Thank you in advance