I've gone through the process of authenticating my meta business account, setting up an active and approved whatsapp sender and creating an approved business-initiated whatsapp template message. Despite all of this when I send a message using the template SID, it returns an error that it's a free-body message and not allowed. Twilio suggests that I use a WhatsApp template which I already am so I'm uncertain how to fix this.
This is the code snippet in question:
from twilio.rest import Client
import json
twilio_whatsapp_number = 'whatsapp:+27**********'
recipient_whatsapp_number = 'whatsapp:+27*************'
content_variables = {
"1": "John Doe"
}
content_variables_json = json.dumps(content_variables)
message = client.messages.create(
from_=twilio_whatsapp_number,
to=recipient_whatsapp_number,
content_sid="HXd*********************c5",
content_variables=content_variables_json
)
print("Message SID:", message.sid)