getWhatsAppMessageTemplate method

Future<GetWhatsAppMessageTemplateOutput> getWhatsAppMessageTemplate({
  1. required String id,
  2. String? metaTemplateId,
  3. String? templateLanguageCode,
  4. String? templateName,
})

Retrieves a specific 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 metaTemplateId : The numeric ID of the template assigned by Meta.

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<GetWhatsAppMessageTemplateOutput> getWhatsAppMessageTemplate({
  required String id,
  String? metaTemplateId,
  String? templateLanguageCode,
  String? templateName,
}) async {
  final $query = <String, List<String>>{
    'id': [id],
    if (metaTemplateId != null) 'metaTemplateId': [metaTemplateId],
    if (templateLanguageCode != null)
      'templateLanguageCode': [templateLanguageCode],
    if (templateName != null) 'templateName': [templateName],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/v1/whatsapp/template',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return GetWhatsAppMessageTemplateOutput.fromJson(response);
}