I want to send out an email to all customers currently sitting in our ‘newsletter ‘ group asking them to opt in / subscribe to being in new 'Event & training group / Updates & information group...etc. We are getting ready for GDPR / 25th May.

What would be the easiest way to do this? Has anyone got any examples of how they have done this were customers have just clicked on a links and they have then automatically ended up in a group?

Thanks Anna

  • I've just added an answer, but a bigger question is to maintain an audit trail of this, as required to evidence consent. I'm not asking for an answer here (not what comments are for), but just logging it for anyone else thinking about GDPR! Mar 1, 2018 at 11:04

5 Answers 5


Mmm... Unless I'm mistaking your intention, this should be very easy to do with a webform, if you are using Drupal with Civicrm and the Civicrm webform integration module.

As far as I know, if your email asks them to go to your webform by clicking a link that contains the 'contact hash' token, then when they get to the webform it will be prefilled with their details.

In the Civicrm section of the webform config screens you can choose which Civicrm info to include, and also whether to add the user to a Civicrm group when the form is submitted. (You'd need to make your group in Civi before configuring this part of the webform.)

Then the user simply clicks 'submit' and they will be added to your group.

Hope I've got the right end of the stick here and that this is helpful.


I would do this with a webform and configuration to select the group automatically on a trigger. To do this with a separate link would require a little amount of coding.


I wrote an extension that ALMOST does this - and I started work to support "add to group with a single click from email" in my Fast Action Links extension. I never added that feature because it was an unfunded side project. It would probably take 2-3 hours to complete.

If you're a coder, you can download the extension and see the commented-out "token" section. It would need to be finished, plus a call to hook_civicrm_apiWrapper for security purposes.


I think you can do this using CiviCRM Profiles. Ish.

  1. Create a profile (Administer » Customise Data and Screens » Profiles)

  2. Open the profile's Advanced Settings and look for "Add new contacts to a group" and select the new mailing group you want to invite people into.

  3. Save the profile then add any fields you want the user to be able to see/edit.

  4. Now you have a form that users can use to add themselves into your database and onto your new list, you just need to provide people with a special link in your email. Read on.

  5. In the profiles page, identify the ID of the new profile, which will be a number. I'm going to pretend mine is 123 for this example.

  6. Draft a mailing. Add a link with whatever text you want and craft a URL like this (Drupal example, enjoy adjusting for WP/joomla at your leisure):

  7. Send yourself a test mailing and open the link in a not-logged in browser ( e.g. use a "Private Browsing" or "Incogneto" tab. You should see a form and if you submit that form you should be added to your new group.

Yes but I want a one-click solution!

Yes I didn't miss that, which is why I said this was an "ish" solution. You could achieve this, if really necessary, by including custom javascript on the profile form that automatically submitted the form as soon as the page loads.

This sounds quirky but has other advantages too, well, one, which is that it saves your link from being "clicked" by spam/virus checkers that may scan the email before it lands in the recipients inbox. If it was a 'open this link and something gets changed' then these automated systems would mess it up for you quite a lot. But these automated systems won't execute javascript, so that way you get the functionality without the side effects. I believe this is how (and why) Mailchimp do this on their unsubscribe links.

Q. How to include javascript on a particular profile form? Try hook_civicrm_buildProfile

(EDIT: corrected the magic link above - it was previously taking you to just a view, not an edit form.)


I think this what you are looking for, but some tweak is required to work properly with CiviCRM 5.x


Use it along with the GDPR extension.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.