updateWhatsAppMessageTemplate method

Future<void> updateWhatsAppMessageTemplate({
  1. required String id,
  2. bool? ctaUrlLinkTrackingOptedOut,
  3. String? metaTemplateId,
  4. String? parameterFormat,
  5. String? templateCategory,
  6. Uint8List? templateComponents,
  7. String? templateLanguageCode,
  8. String? templateName,
})

Updates an existing WhatsApp message template.

May throw AccessDeniedByMetaException. May throw DependencyException. May throw InternalServiceException. May throw InvalidParametersException. May throw ResourceNotFoundException. May throw ThrottledRequestException.

Parameter id : The ID of the WhatsApp Business Account associated with this template.

Parameter ctaUrlLinkTrackingOptedOut : When true, disables click tracking for call-to-action URL buttons in the template.

Parameter metaTemplateId : The numeric ID of the template assigned by Meta.

Parameter parameterFormat : The format specification for parameters in the template, this can be either 'named' or 'positional'.

Parameter templateCategory : The new category for the template (for example, UTILITY or MARKETING).

Parameter templateComponents : The updated components of the template as a JSON blob (maximum 3000 characters).

Parameter templateLanguageCode : The language code of the message template (for example, en or en_US). Use together with templateName as an alternative to metaTemplateId to identify a template.

Parameter templateName : The name of the message template. Use together with templateLanguageCode as an alternative to metaTemplateId to identify a template.

Implementation

Future<void> updateWhatsAppMessageTemplate({
  required String id,
  bool? ctaUrlLinkTrackingOptedOut,
  String? metaTemplateId,
  String? parameterFormat,
  String? templateCategory,
  Uint8List? templateComponents,
  String? templateLanguageCode,
  String? templateName,
}) async {
  final $payload = <String, dynamic>{
    'id': id,
    if (ctaUrlLinkTrackingOptedOut != null)
      'ctaUrlLinkTrackingOptedOut': ctaUrlLinkTrackingOptedOut,
    if (metaTemplateId != null) 'metaTemplateId': metaTemplateId,
    if (parameterFormat != null) 'parameterFormat': parameterFormat,
    if (templateCategory != null) 'templateCategory': templateCategory,
    if (templateComponents != null)
      'templateComponents': base64Encode(templateComponents),
    if (templateLanguageCode != null)
      'templateLanguageCode': templateLanguageCode,
    if (templateName != null) 'templateName': templateName,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/whatsapp/template',
    exceptionFnMap: _exceptionFns,
  );
}