Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
980 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Good Day,
At WhatsApp advanced messaging
Is that possible to send template message including image at header supported?
messaging_client = NotificationMessagesClient.from_connection_string(connection_string)
channelRegistrationId = "1ea07df4-9843-438b-887e-d8891ba4a201"
phone_number = "xxxxx"
# Template Name bulk_azure_insta_ar
input_template: MessageTemplate = MessageTemplate(
name="bulk_promo",
language="ar")
template_options = TemplateNotificationContent(
channel_registration_id=channelRegistrationId,
to=[phone_number],
template=input_template
)
System.Private.CoreLib: Exception while executing function: Functions.HusAzFuncBulkSend. System.Private.CoreLib: Result: Failure
Exception: HttpResponseError: (BadRequest) Given request contains a parameter for WhatsApp which was invalid. This includes channel ID and template parameters.
Code: BadRequest
Message: Given request contains a parameter for WhatsApp which was invalid. This includes channel ID and template parameters.
Inner error: {
"code": "WhatsAppAdminClient+WaErrorCode.InvalidParameter",
"message": "InvalidParameter: (#132012) Parameter format does not match format in the created template. header: Format mismatch, expected IMAGE, received UNKNOWN"
}
Hi
Welcome to the Microsoft Q&A Platform!Welcome to the Microsoft Q&A Platform! The error indicates that the template message for WhatsApp has a format mismatch issue, specifically in the header. It expects an IMAGE format in the template's header but is receiving an UNKNOWN format.
https://example.com/image.jpg
). update the code,
from azure.communication.notification_hubs import NotificationMessagesClient, TemplateNotificationContent, MessageTemplate
messaging_client = NotificationMessagesClient.from_connection_string(connection_string)
input_template = MessageTemplate(name="bulk_promo", language="ar")
template_options = TemplateNotificationContent(
channel_registration_id="1ea07df4-9843-438b-887e-d8891ba4a201",
to=["xxxxx"],
template=input_template,
media={"header": {"type": "image", "url": "https://example.com/image.jpg"}}
)
response = messaging_client.send(template_options)
print(response)
connection_string
, channel_registration_id
, and phone number.