mailjet / mailjet-apiv3-php

[API v3] Mailjet PHP Wrapper
http://dev.mailjet.com
MIT License
267 stars 86 forks source link

Unable to attach TemplateID to campaign #226

Closed iSecret2048 closed 2 years ago

iSecret2048 commented 3 years ago

Hi there,

I'm trying to follow Mailjet's Send campaigns using drafts guide to integrate this feature into a company's CMS. However I've got stuck, while implementing this.

I've managed to create a campaign draft via API, that works fine. I've also created my marketing templates before hands in MJML - via API that also works.

However, once I want to perform the template linking to the campaign draft, with the steps according to the guide "Once the template is created, do a PUT on /campaigndraft to link the template ID to your draft." I get stuck.

I receive a response from the API, with my template ID linked, however in Mailjet's web control panel the Content field in the campaign's details is grayed out. Also, if I want to test this campaign, I receive a Missing content error.

I'm trying to follow the steps in the guide mentioned above, however this doesn't seem to work.

Am I missing here something?

gauthiermarchand commented 3 years ago

Hi,

We trying to do the same and we received the same error message.

Have you guys check this issue ?

Thanks in advance

iSecret2048 commented 3 years ago

Hello,

We are still facing this issue. For the last 1-2 weeks, we're being in touch with Mailjet via their support (ticketing system).

I've mentioned this ticket to them, so they probably know about this. I don't know, what will be the outcome of this.

gauthiermarchand commented 3 years ago

Hi,

We reported that issue too. Hopping they could find a solution 🤞

Thank for your comment.

gauthiermarchand commented 3 years ago

Hi,

We got an answer from the Mailjet team through our marketing agency.

L'ajout du template_id à un draft campaign n'importe pas le template sur le brouillon. La campagnedraft content doit être créee via /campaigndraft/$ID/detailcontent: https://dev.mailjet.com/email/reference/campaigns/drafts#v3_post_campaigndraft_draft_ID_detailcontent

Il ne s'agit pas d'un bug, les informations communiquées dans le guide sont fausses. La bonne approche ici est de faire : un GET sur /detailcontent du template marketing, et d'importer le /detailcontentand de la campaigndraft.

It means that adding the template id to a campain draft will not act on the draft. The draft content has to be create from the route /campaigndraft/$ID/detailcontent

This is not a bug, the informations from the documentations are false. The good approach is to GET the content from the template you would use et to inject this one to the DetailContent of the CampainDraft

So, I tried this and... It Works !

I created the CampainDraft, then I get the content from my template and then I added this content to my CampainDraft.

I hope this will help you. Let me know if it is.

iSecret2048 commented 3 years ago

Hi,

We've received the same respond from Mailjet's support team.

Our workaround is almost the same as yours, the only difference is that - to add the content to the campaign draft, first we need to generate the HTML from our MJML templates.

We dynamically generate our MJML templates, but the Mailjet's system displays the content only if it is in HTML.

We tried to add the content to the campaigndraft via MJML - the content was there in MJML, but it wasn't displayed at all in the control panel and the test send out failed (Error: Missing content). After adding the content to the campaign draft in HTML besides MJML, it worked - both the display and the test send out.

I'm glad, that after weeks of struggling with this issue it's finally "sort of" resolved! 🙂

gauthiermarchand commented 3 years ago

Hi,

I'll keep that in mind if we have to work with MJML in the future.

Thanks for sharing this case with us !

I'm glad too ! Hopping that MailJet will update his doc and explain this kind of use 🙂

oleksandr-mykhailenko commented 2 years ago

Looks like the issues was resolved. Close it