I'm using the REST API to create contacts and add them to an existing mailing group. I want to add them as pending and trigger the confirmation email but I can't find a way to do it via the API.

The extension org.civicoop.emailapi seems like it does what I need but it only supports up to 4.6 and I'm running 5.0.2.

Are there any other options?

edit - I've installed org.civicoop.emailapi and it's working under 5.0.2, but I can't make it send the group confirmation email as it's not a normal mailing template.

edit - If I create my own mailing template, I can't find a token that generates the confirmation link for a specific user and a specific group. To be clear, I want to recreate the {subscribe.url} token from the Subscription Confirmation Request automated message.

2 Answers 2


We’re using civicoop email api extension on 4.7 and that means it should work on 5.x as well.

  • Thanks, I've just installed it and it's working fine. I'm still having trouble though. emailapi works to send an email using a template from Mailings > Message Templates, but the group confirmation email is not in this list.
    – Piggo
    May 11, 2018 at 13:12
  • 1
    You need to create your own Message Template May 11, 2018 at 16:43
  • Thanks Karin. I have tried that but I can't find a token that can be used for confirmation of group membership. The closest I have found is {action.subscribeUrl.gid}, but this only gives a link to a page where a user can enter their email, and in fact the token does not work at all in an email sent using the emailapi.
    – Piggo
    May 15, 2018 at 10:17
  • This is more of a comment than an answer to the question. Jul 13, 2018 at 12:26

I've found the answer.

I was calling GroupContact > Create with parameter Status=Pending. This worked to create the pending contact but as far as I can find there is no way to then trigger the double opt-in email.

The solution is instead to call MailingEventSubscribe > Create, with parameters for email address and group id. This adds the pending GroupContact and sends the double opt-in email.

For my use case, I needed to create the contact at the same time, so I use separate API calls of Contact > Create, then MailingEventSubscribe > Create.

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.