How to Receive Messagen from WhatsApp API to action devices

Hello! Anyone know how I can configure an official WhatsApp API (Meta Developers) in Home Assistant so that when I send a specific message, like “gate” it will open the gate?

I tried to do this function using “Phone last notification” and it doesn’t work, because when I have 2 or more notifications, HomeAssistant gets confused.

I saw some tutorials on how to do it with NodeRED, but I only found tutorials with unofficial APIs, for me it’s a problem because I want the system to always work.

From what I saw, it would be possible to create a Webhook to synchronize with the APP at Meta Developers, but I couldn’t figure out how to create this Webhook valid through NodeRED, or if it has to be in another location, like rapidapi or webhooksite.

I also tried using Nabucasa, I saw that you could create it from a trigger, but I couldn’t figure out how to link it to NodeRED to get the messages.

In our project we need to analyze the messages, because each command sent will trigger a different device. “gate” open/close the gate while “alarm” active the alarm. I believe that in this case, it would also be possible to do it through automation, but again I don’t know how to do it.

Can someone help me?

Use the webhook trigger from “pure” HA automations

I read this documentation, but I didn’t really understand how to do it.

What is not clear, exactly?
What did you try, already?

From what I saw in Meta’s documentation, the webhook must be a valid https link, that is, it cannot give a message about an insecure certificate.

So the first point, I can’t get my Home Assistant to work over https. Another thing, it seems that Meta doesn’t accept ports, it has to be a direct link, I would have to change the HA port to 80, my provider doesn’t release this port, so it wouldn’t work either, even on https (from what I saw in the documentation ).

So I think the “ideal” would be to use the nabucasa webhook to intermediate. I even tried to generate the webhook with a long-lived token, but without success, 404 Not Found appears.

That would be a good first step indeed.
Maybe also have a look at

to start to understand HA basics.

thanks for yout time.