Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Boštjan Pelko 2 posts 72 karma points
    Jun 03, 2022 @ 12:07
    Boštjan Pelko
    0

    Programmatically creating and sending newsletter in Newsletter Studio version 4 not work

    Hi Markus !

    I'm testing NesletterStudio version 4 for composing and sending newsletters.

    My problem is programmatically creating and sending newletter(s) after publishing content (example news) in Umbraco Backoffice.

    I see this example code on this page but does't work in version of Newsletter Studio 4: https://www.newsletterstudio.org/help/develop-with-newsletter-studio/working-programmatically/

    Is there any option to create newsletter campaign and send it to mail recipient ?

    Best regards, Boštjan Pelko

  • Markus Johansson 1809 posts 5376 karma points c-trib
    Jun 03, 2022 @ 16:50
    Markus Johansson
    0

    Hi!

    This should be supported, if not we’ll make adjustments to support it.

    I need a day or two to get back with and update and hopefully some examples.

    Stay tuned.

    Have a nice weekend!

  • Boštjan Pelko 2 posts 72 karma points
    Jun 07, 2022 @ 07:38
    Boštjan Pelko
    0

    Hi Markus !

    When did you plan new release of Newsletter Studio for Umbraco 9 that support this functionality ?

    Have you already checked to see if the library already supports this functionality ?

    Mybe will you prepare any code examples ?

    Best regards, Boštjan Pelko

  • Markus Johansson 1809 posts 5376 karma points c-trib
    Jun 07, 2022 @ 09:44
    Markus Johansson
    0

    Hi!

    The current public API does not expose the methods needed to be able to save a campaign. However, this is something that we want to support.

    Just to be on the safe side here, could you explain your use case more in-depth so that we make sure it can be supported. What do you need to do?

    Is this an existing site that you are upgrading or a green field project?

    Cheers!

  • Blaž Lozej 4 posts 74 karma points
    Jun 08, 2022 @ 13:28
    Blaž Lozej
    0

    Markus, our client wants to send a newsletter campaign every time an article is published. To automate this process we subscribe to the publish event, but we are missing the api to create a new newsletter campaign and send it.

    Any timeline predictions on when this will be available?

    Thanks, Blaž

  • Markus Johansson 1809 posts 5376 karma points c-trib
    Jun 08, 2022 @ 13:32
    Markus Johansson
    0

    Hi!

    I'm thinking that it should probably be possible to just create a newsletter from code, inject HTML and then schedule it to be sent right away.

    It sounds like this "just" means that we have to make some of the APIs public and release a new version.

    I will look at this and ping you here. Can't really promise any timeline but how urgent is this on your side?

  • Markus Johansson 1809 posts 5376 karma points c-trib
    Aug 11, 2022 @ 14:41
    Markus Johansson
    0

    Hallo guys!

    Thank you for your patience around this feature, it was not as straight forwards as I was thinking. Maybe you have already moved on to another solution but I was hoping for some input from you regarding how you intend to use it.

    When your editor publishes a new article you want to send a Campaign, my question is - what should this look like? Are you thinking that you want to create all the HTML for the email based on the created article and then send this as a Campaign or do you want to duplicate an existing draft-campaign and just send a generic "alert campaign"?

    Basically, any campaign created in the "Email Editor" will be based on blocks and can be edited inside the editor in the backoffice. It would be technically possible to programmatically create/edit the blocks inside the campaign but probably quite complicated.

    It's also possible to create a Campaign with only HTML-content (not block based), this is what we're using when we're sending from the content section. This feature was created to facilitate similar use cases but it does not automatically send the email since most users want to explicitly press a send button when they feel that the article is ready to push out for a email a campaign.

    Maybe this approach could suit your needs? I will still continue to investigate how we can make it possible to create and send (schedule) emails from code but there is quite a lot of things that is impacted when one want to create a HTML-only email from code and have it show up in the campaigns-list in the backoffice.

    Please let me know more about your use cases and I'll do my best to facilitate them.

    Cheers!

  • Marco 11 posts 81 karma points
    1 week ago
    Marco
    0

    Hello Markus!

    Do you have updates about possibility to create a campaign (from an existing content) programmatically and send it (also via code)?

    Thanks, Marco

  • Markus Johansson 1809 posts 5376 karma points c-trib
    1 week ago
    Markus Johansson
    0

    Hi Marco!

    I have not continued the implementations as I'm still trying to figure out use cases we need to support.

    I would love to hear more about your use case and what you need to able to do and I'm more than open to facilitating something that makes this possible. Could you share more information about what you need to do? Would also be great to know more about how things should be triggered, how you need to build the content of the email, and so on.

    Cheers!

  • Marco 11 posts 81 karma points
    1 week ago
    Marco
    0

    Hi Markus! Thanks for reply!

    We have a custom content for newsletter adding the documentype alias into appsettings.json like this:

    "NewsletterStudio" : {
            "CampaignContentTypes" :  "myCampaignContentTypeAlias,anotherCampaignContentTypeAlias"
        }
    

    This content contains an RTE in which we put macros. The goal is to send this content multiple time automatically because is a daily newsletter so is bad create a new content manually each day

    The idea that I have is the following:

    1. Create a new Newsletter content programmatically (or duplicate from existing one like draft)
    2. Create a new Campaign programmatically (missing service for this)
    3. Send it

    So in this way I can still have all newsletter studio functionality like analytics but is not necessary create the same content manually each day.

    Do you have any suggestion about how reach this with current version of Newsletter Studio for Umbraco 10?

    Please if you need more details let me know.

    Thanks, Marco

  • Markus Johansson 1809 posts 5376 karma points c-trib
    1 week ago
    Markus Johansson
    0

    Hi Marco!

    Thanks for sharing more details about your use case.

    If I understand you correctly you intend to have one content node with this RTE and then you basically need to render this page once every day and send it to a list of recipients?

    More ore less, you want the same behavior as manually creating/sending a campaign from our "Content App" that is visible for the configured CampaignContentTypes - right?

    So just to give you some background on the challenge on our side, we basically have two types of campaigns:

    • Campaigns built with the email editor (rows/columns/cells saved in our db)
    • Campaigns sent from a content node (raw html saved in our db). Always associated with a content node.

    So the solution would be to expose an API/Service where one can create an email from C# code, however, at the moment it would be quite hard for us to support a scenario where someone creates a HTML-email without associating it with a content node - which is technically possible but we would not be able to show any UI for this when it's still in draft.

    However, I think that this is kind of an edge case that should not prevent us from exposing this as work on a solution for the edge case after that.

    I did start some work on this and will spend some more time exploring this in the upcoming days. I hope the be able to publish a new version with a API that you can access and try out in the beginning of next week.

    Does that sound like a plan?

  • Marco 11 posts 81 karma points
    1 week ago
    Marco
    0

    Hi Markus!

    thanks for support!

    Yes could be helpfull. In this way, we can:

    1. Create the email retreiving data from umbraco content node
    2. Create the Campaign (Needs an API also for this step?)
    3. Send it

    About the campaign and related analytics? Do you know if is necessary create something also for that?

    Thanks again and please let me know if you have other doubs.

    Marco

  • Markus Johansson 1809 posts 5376 karma points c-trib
    1 week ago
    Markus Johansson
    1

    Hi!

    Yes that's right. You should be able to render what ever HTML you need using the standard razor-pages and any Umbraco-features that you want. We would basically take the HTML-output and use that as body for the email.

    I've looked at this and I think I've managed to get pass the biggest "hurtles" with the implementation and I have a solution that is almost ready to try out.

    You would basically be able to create the CampaignEmail from code, we would update the HTML of the email by rendering the content node and then send it.

    I need a day or two more to make sure that it's in a good state and then I would be happy to work together with you to make sure that you can achieve your goals around this.

    I'll reach out when the updates is available on NuGet for you to download.

    All the best!

  • Marco 11 posts 81 karma points
    1 week ago
    Marco
    0

    Thanks for the support! I'll wait your update in order to try if we can implement it using new version.

    Just to confirm we are currently using the newsletter studio 10.0.0 running on Umbraco 10

    Best Regards, Marco

  • Markus Johansson 1809 posts 5376 karma points c-trib
    1 week ago
    Markus Johansson
    1

    Hi Marco!

    Just wanted to let you know that Newsletter Studio v10.0.2 is out on NuGet with the needed APIs added. I've updated the documentation with some examples (still work in progress) so please feel free to ask if you need help.

    https://www.newsletterstudio.org/documentation/package/10.0.0/develop/sending-campaigns-programmatically/

    Looking forward to hearing your feedback!

  • Marco 11 posts 81 karma points
    5 days ago
    Marco
    0

    Hi Markus!

    thanks a lot! Let me check and I'll try to implement automatic flow. I'll come back with feedback about it!

    Thanks again!

  • Marco 11 posts 81 karma points
    1 day ago
    Marco
    0

    Hi Markus!

    New version works like a charm :) I implemented my solution using duplicate function from an existing campaign in order to reuse the same template and change other information like contentype id or Subject.

    If I can give to you a suggestion:

    Is a nice to have a way, or expose a function, that able us to search existing campaing (for exampline giving content id and campaign name as input params) because duplicate function needs the id of existing campaign.

    For now I solved getting the id from save request on backoffice or doing a query directly on database.

    Otherwise do you have suggestion about how retrieve existing campaign id?

    I'll let you know if someother things will comes out in the next period

    Thanks again for your support!!!

  • Markus Johansson 1809 posts 5376 karma points c-trib
    22 hours ago
    Markus Johansson
    0

    Hi!

    Great news! I'm happy that the first version with the API seems to be working!

    Hmm, I think that there is a "GetByContentKey"-method on the internal Campaign Service - is that what you are looking for? Basically, returning a list of all Campaigns created based on a given Content Node?

    I think that you're workaround might be your only option at this exact moment but it would to add a couple of more methods to the ICampaignEmailService to be able to fetch existing once. I will make sure to push a new release in upcomming week to facilitate this.

    Did you experiance any other "hurdles" during your implementation? Was the documentation clear or anything that was hard to understand/implement?

  • Marco 11 posts 81 karma points
    22 hours ago
    Marco
    0

    Hi!

    yes "GetByContentKey" could also help me after obtaining the list of campaings I can filter these with a Where clause giving specific name.

    No "hurdles" during my implementation. Everything is really clear and works properly, honestly is really a great job considering also the short creation time of the new release version :)

    Thanks, Marco

Please Sign in or register to post replies

Write your reply to:

Draft