1

I am using Cloud API Whatsapp but not sending a message to any number, I get a 200 status when I make a request to graph.facebook.com but I am not received the message in my Whatsapp number.

This is an example configuration for Node with Axios

var axios = require('axios');
var data = '{\r\n    "messaging_product": "whatsapp",\r\n    "to": "00000000000",\r\n    "type": "template",\r\n    "template": {\r\n        "name": "hello_world",\r\n        "language": {\r\n            "code": "en_US"\r\n        }\r\n    },\r\n}';

var config = {
  method: 'post',
  url: 'https://graph.facebook.com/v13.0/103491645721389/messages',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer token'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

I dont have problems for show bearer token and my phone because only I am testing the API.

I want to know if the reason I can't see the message on Whatsapp is that many people are using it and maybe there are problems. Or maybe I'm setting something wrong. Yesterday when I tried everything was going great, but today I only receive the status 200 but it does not show me the message. I have recreated another app in developers.facebook but nothing happens.

Some video or guide to implementing the API in Node?, because in the documentation it is in curl and I need to guide myself with Node

151291
  • 3,308
  • 7
  • 48
  • 81
Husdady
  • 145
  • 3
  • 12
  • "*I dont have problems for show bearer token and my phone because only I am testing the API.*" Regardless of whether or not you are "*only [...] testing the API*", knowledge of this authentication token will allow others to make (malicious( requests to the associated API as *you*, and your phone will likely be scraped by unscrupulous bots and added to various spam lists by your having just included it here. You should remove it, but it's likely already too late for both pieces of this information as it's cached by search engines quite quickly. You should invalidate your bearer token ASAP. – esqew May 30 '22 at 16:49
  • I see you've edited the sensitive information from your post, but it's still freely available in the [edit history](https://stackoverflow.com/revisions/72437657/1), which is why you should still seek to invalidate the token as soon as possible. – esqew May 30 '22 at 16:55
  • I feel that by posting this question on sites like this, I'm free from potential attacks, I really don't think there are malicious people on Stackoverflow trying to spam you. Similarly, I have already edited the question, although I still do not get a solution – Husdady May 30 '22 at 16:56

3 Answers3

5

I had the same doubt because I was not able to do this neither with CURL or Python, so I made a similar post. The answer is basically that the recipient must send a message before you can use a non-template message.

Hope this helps, and check that post a for a better explanation.

Alex Turner
  • 698
  • 6
  • 16
  • 1
    If another post adequately resolves the inquiry at hand, don’t post a link-only answer and instead vote or flag it as a duplicate. This helps to better ensure content quality in the future – esqew Jun 09 '22 at 15:37
  • Is not duplicate because is not strictly the same way of doing it, so I did not think it was right to mark it. Besides, this post was created first, so I don't think it's a repost or duplicate either, but you are the admin with the experience so I'll take your advice for the future. Thanks – Alex Turner Jun 09 '22 at 18:47
  • Thanks. This resolved the issue for me. However is this applicable for paid plans? Or this limit is applicable only for developer? – Nikhil Sep 01 '22 at 11:38
0

Something similar happened to me, I used the example that came out after the application had just been created, it said 200 but no message arrived at the number in question, the problem was that apparently from so many shipments for another application that I had, where I also placed that same number, this It was blocked for 24 hours, in short, if you try another number that you have not used in other applications, you should receive the message without problems, it will surely help you.

  • I have tried with other numbers, however, the opposite happens to me, it only reaches the one that I use for testing, and in production it does not arrive, especially when they are interactive type messages – Ransomware0 Dec 22 '22 at 06:10
  • When you want to send messages to any number, whether or not you had a previous conversation, you must send using message templates, if you don't, the message will not arrive, sorry for the late response, I share the following documentation [link](https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates), I hope it helps – javierblancoch Jan 20 '23 at 11:36
-1

This happened when you use the provided test phone number (I don't know why), try a production phone number.