Closed claudineibr closed 1 year ago
Hi @claudineibr you will need to send the pdf documents using a media id or an external link. For using media Id, you will need to upload pdf document using **uploadMedia function which will return the media Id for your pdf document**.
I'm yet to test sending DocumentTemplateMessage using media Id. The implementation of the document template message was done to support pdf or any document file that is hosted by an external link that WhatsApp can use to retrieve the document file.
The approach to sending DocumentTemplateMessageRequest may be similar to ImageTemplateMessageRequest but it will depend on the number of parameters you have defined for your template message.
DocumentTemplateMessageRequest imageTemplateMessage = new DocumentTemplateMessageRequest();
documentTemplateMessage.To = sendTemplateMessageViewModel.RecipientPhoneNumber;
documentTemplateMessage.Template = new DocumentMessageTemplate();
documentTemplateMessage.Template.Name = sendTemplateMessageViewModel.TemplateName;
documentTemplateMessage.Template.Language = new DocumentMessageLanguage();
documentTemplateMessage.Template.Language.Code = LanguageCode.English_US;
documentTemplateMessage.Template.Components = new List<DocumentMessageComponent>()
{
new DocumentMessageComponentt()
{
Type = "header",
Parameters = new List<DocumentMessageParameter>()
{
new DocumentMessageParameter()
{
Type = "document",
Document = new Document()
{
Link = "<EXTERNAL_LINK_DOCUMENT>" // Link point where your document can be downloaded or retrieved by WhatsApp
}
}
},
},
new DocumentMessageComponent()
{
Type = "body",
Parameters = new List<DocumentMessageParameter>()
{
new DocumentMessageParameter()
{
Type = "text",
Text = "Order Invoice"
},
}
}
}
Let me know if sending a document template message using an external link solves your issue.
Sorry, maybe my message wasn't clear, I did exactly like the example you gave, but the problem is that I couldn't find the interface to send DocumentTemplate like there is for image. see image I believe there should be a
SendDocumentAttachmentTemplateMessageAsync
I can see the method is missing in the interface. I will add the implementation of SendDocumentAttachmentTemplateMessageAsync
method today.
Thank you!
I have implemented the method. You can test it and let me know if it works on your side.
I have implemented the method. You can test it and let me know if it works on your side.
It worked out! Thanks! A question, can you inform the caption because the domento name is going empty
I added an extra property for filename and caption for the document template message request. I guess specifying on the caption or filename should work,
I added an extra property for filename and caption for the document template message request. I guess specifying on the caption or filename should work,
ok, as soon as it's available I'll test and report the result. Thanks
Alright. The package update should be available as of now.
Alright. The package update should be available as of now.
When you pass the caption parameter, an error is thrown
Passing filename works, I think the caption can be removed
Thanks for the update. I think I will leave the caption property. They may add caption support for document template messages.
I didn't find the implementation for sending pdf documents, is this feature implemented?