Jump to content

a hook to send an email to each client when there is a new announcements post


plusplushosting

Recommended Posts

Hi guys!

Im looking for a hook that trigger a message sent to each Active clients when there is a new announcement post. I have two languages so if is possible have in both languages (depending if the client is set to default/language A o language B will be great. The message shouldnt be the announcement itself, just something like "hey, there is a new announcement, please check your client area at https.....". If it can use the templates great, if not a hardcoded text can work too.

Thanx in advance!

Link to comment
Share on other sites

You could do use AnnouncementAdd (and edit), but one problem I see here is when the hook runs it will try to send all mail out at the same time.  That could cause issues, like some mail servers blocking you, and depending on how many there are the whole thing could timeout.  Instead, what I would recommend for this is a using AnnouncementAdd / AnnouncementEdit and a cron that calls an addon module that checks for the new announcement flag (or what have you) and then sends the emails in batches.  That would mimic the mass mail tool.  Or maybe figure out a way to use the mass mail tool for this purpose  

 

Link to comment
Share on other sites

well WHMCS have already declined the suggestion, so no point waiting for them to do this...

in addition to @steven99 suggestions, i'd add one more possibility - using MailChimp's RSS To Email feature...

https://mailchimp.com/help/share-your-blog-posts-with-mailchimp/

Quote

If you have a blog, you may want to use an RSS campaign to email new posts to your subscribed contacts. RSS campaigns use merge tags to pull in RSS (Real Simple Syndication) content from a blog feed. When an RSS feed is updated with new blog posts, Mailchimp will pull that content into the campaign and send it to your subscribers on the schedule you choose.

the WHMCS Announcements page creates it's own RSS feed, so that could be utilised by MailChimp for this purpose.

though if you're not creating announcements frequently, you may just find it easier to use the Mass Mail function directly in WHMCS.

Link to comment
Share on other sites

one more please....in the export section in whmcs i do not see an option to export clients data based in the language (im not sure how at this point where mailing is priority you cant filter by language in this area). Can you have at hand the mysql query to return the first name, last name and email address of all clients in the table by language? Im thinking to get a csv using phpmyadmin and then import it into mailchimp specific list for each language.

Also...as i said before...at this point not having a way that the mailchimp addon in whmcs be multi language is a bit frustrating. People signing up for example using French or spanish should receive the transactional email in the default language no make sense and probably is the worst thing you can do in marketing. Imagine being from US receiving an email in chinese 🙂

Thanx again!

Link to comment
Share on other sites

46 minutes ago, plusplushosting said:

one more please....

giphy.gif

46 minutes ago, plusplushosting said:

in the export section in whmcs i do not see an option to export clients data based in the language (im not sure how at this point where mailing is priority you cant filter by language in this area).

are you thinking of the Clients Report?

the problem here is that it's possible that WHMCS doesn't store the language for all clients in the database - if the client has chosen a language (e.g if they've changed it while logged in), then it will be stored in the tblclients table; if they haven't, then they will use the "default" language for your installation (as per your localisation settings) and the entry in the database will be empty.

46 minutes ago, plusplushosting said:

Can you have at hand the mysql query to return the first name, last name and email address of all clients in the table by language?

to get a list of English-specified language clients, you should just need to use...

SELECT tblclients.firstname,tblclients.lastname, tblclients.email FROM tblclients WHERE tblclients.`language` = 'english'

and then change the last term from 'english' to 'spanish' to get a Spanish list... if you're lucky, all your clients will be in one list or the other, but as I said previously, you may have some that will be in neither.

46 minutes ago, plusplushosting said:

Im thinking to get a csv using phpmyadmin and then import it into mailchimp specific list for each language.

if it helps, i've attached a modified version of the "Clients" report, just upload it to /modules/reports and you should be able to access it either via the front page of Reports or from the sidebar list...

yMUrwvU.png

with that, you can create filtered lists with specific languages (e.g english, spanish or leave blank)...

  • English -> J5J9kRQ.png
  • Spanish -> cYuE8gU.png
  • None (default) -> AdSNRQw.png

or don't select any filter options and you'll get an entire list of all your clients.

clients_with_language.php

Link to comment
Share on other sites

  • 4 weeks later...
On 2/13/2019 at 9:52 AM, brian! said:

the WHMCS Announcements page creates it's own RSS feed, so that could be utilised by MailChimp for this purpose.

though if you're not creating announcements frequently, you may just find it easier to use the Mass Mail function directly in WHMCS. 

This was working great...until i have updated the spanish language file and changed the days of the week and months to the spanish one.....as far as i see rss is using the pubdate tag with the translated text and mailchimp rss is not recognizing it....any way to force the date in the pubdate in the rss be only in english format no matter if the announcement is post in different language? or any file to edit for the rss feed?

Thanx!

Link to comment
Share on other sites

18 hours ago, plusplushosting said:

This was working great...

uh oh!

18 hours ago, plusplushosting said:

any way to force the date in the pubdate in the rss be only in English format no matter if the announcement is post in different language?

I would have thought that you could pass a language to the RSS feed URL and it should use that language for the dates, e.g /annoucements/rss?language=english - i've just tried that locally with the language set to Spanish in WHMCS, but passing English in the RSS URL and it's outputting the pubDate in English rather than Spanish. 🙂

you could try changing the RSS URL in the MailChimp settings to include the language and see if that works with Mailchimp.

18 hours ago, plusplushosting said:

or any file to edit for the rss feed? 

they're all encrypted. ⚠️

Link to comment
Share on other sites

Hi Brian, i already have /annoucements/rss?language=spanish....but as i have translated the english.php language and the date (months, weekdays) are translated in spanish, the rss feed is getting those translated info, not recognizing the date.

keep in mind i have two lists...one for english, passing /annoucements/rss?language=englsih and one for spanish passing /annoucements/rss?language=spanish

Thanx!

Link to comment
Share on other sites

1 minute ago, plusplushosting said:

but as i have translated the english.php language and the date (months, weekdays) are translated in spanish, the rss feed is getting those translated info, not recognizing the date.

i'm confused - are you saying that you have an English overrides file that contains Spanish dates ?

Link to comment
Share on other sites

Just now, plusplushosting said:

Then when you pas the rss url with the spanish tag in the url mailchimp is getting the translated date.

ok that makes sense - no obvious way around that (as WHMCS is working as expected) - only thing I can think to suggest would to remove/disable those overrides when you're updating an article or think the feed will be accessed by MailChimp.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated