Answers.Body: <p>This will work in 5.24! As the new "tokenprocessor" functionality in core now has support for activity tokens. You'll also need a modified version of the emailapi extension <a href="https://lab.civicrm.org/extensions/emailapi/-/merge_requests/3" rel="nofollow noreferrer">https://lab.civicrm.org/extensions/emailapi/-/merge_requests/3</a> and you can then use civirules to trigger.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-28T20:41:23.280Z
Answers.LastActivityDate: 2020-02-28T20:41:23.280Z
Answers.UserDisplayName: Matthew Wire
Answers.Body: <p>You can solve this in two ways:</p>
  
  <ol>
  <li><p>Use schedule reminders. You can then use all the activity tokens. Draw back is that this one sends e-mail based on the (scheduled) date of the activity. </p></li>
  <li><p>Use CiviRules and the email api extension. Create a civirule based on the trigger activity is added. Add a condition to limit the civirules to only the activity assignnee and add an action to send an e-mail. I am not sure if all activity tokens work with this solution.</p></li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-29T14:43:18.930Z
Answers.LastActivityDate: 2020-02-29T14:43:18.930Z
Answers.UserDisplayName: Jaap Jansma - CiviCooP
Answers.Body: <p>I'm pretty sure it only happens automatically in the UI form in core (related but separate ticket: <a href="https://lab.civicrm.org/dev/core/issues/1582" rel="nofollow noreferrer">https://lab.civicrm.org/dev/core/issues/1582</a>).</p>
  
  <p>But for the api it shouldn't be too hard have hook_post or something call CRM_Core_BAO_MessageTemplate::sendTemplate(), which will automatically parse CONTACT tokens. If you want activity tokens you could get the same effect by putting smarty variables of your choosing in the template, and then passing in the appropriate activity's values in the $tplParams parameter to the sendTemplate() function. I'm pretty sure I've done something like that in a different context elsewhere, e.g.</p>
  
  <p><code>$tplParams = array('the_subject' =&gt; $activity-&gt;subject);</code></p>
  
  <p>and then in the message template:</p>
  
  <p><code>Here is the activity subject: {$the_subject}</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-28T17:50:11.020Z
Answers.LastActivityDate: 2020-02-28T17:50:11.020Z
Answers.UserDisplayName: Demerit
Body: <p>This feels like a simple one but I am not sure if there is a way to do this. </p>
  
  <p>Does anyone know if you can automate an email to a activity assignee when the activity is created and include activity tokens like {activity.subject}, {activity.activity_date_time} etc.</p>
  
  <p>I want to send emails along the lines of:</p>
  
  <blockquote>
    <p>Your meeting is scheduled with Michael McAndrew at 'Wednesday 4th March, 2pm'. The subject is 'How can I get more involved with your organisation'.</p>
  </blockquote>
  
  <p>I haven't tried the CiviRules route yet (not sure if it supports tokens for activity emails) I'm going to try it now.</p>
  
Tags: <activities><mailing><civirules><automation>
Title: Send an email to activity targets when activity is created via the API
ThreadText: # Send an email to activity targets when activity is created via the API
  
  (Asked by: username_0 on 2020-02-28)
  
  This feels like a simple one but I am not sure if there is a way to do this.
  
  Does anyone know if you can automate an email to a activity assignee when the activity is created and include activity tokens like {activity.subject}, {activity.activity\_date\_time} etc.
  
  I want to send emails along the lines of:
  
  > Your meeting is scheduled with Michael McAndrew at 'Wednesday 4th March, 2pm'. The subject is 'How can I get more involved with your organisation'.
  
  I haven't tried the CiviRules route yet (not sure if it supports tokens for activity emails) I'm going to try it now.
  
  **Tags:** activities, mailing, civirules, automation
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2020-02-28. Score: 3
  
  This will work in 5.24! As the new "tokenprocessor" functionality in core now has support for activity tokens. You'll also need a modified version of the emailapi extension <https://lab.civicrm.org/extensions/emailapi/-/merge_requests/3> and you can then use civirules to trigger.
  
  
  ---
  
  ### Answer by username_2 on 2020-02-29. Score: 3
  
  You can solve this in two ways:
  
  1. Use schedule reminders. You can then use all the activity tokens. Draw back is that this one sends e-mail based on the (scheduled) date of the activity.
  2. Use CiviRules and the email api extension. Create a civirule based on the trigger activity is added. Add a condition to limit the civirules to only the activity assignnee and add an action to send an e-mail. I am not sure if all activity tokens work with this solution.
  
  
  ---
  
  ### Answer by username_3 on 2020-02-28. Score: 1
  
  I'm pretty sure it only happens automatically in the UI form in core (related but separate ticket: <https://lab.civicrm.org/dev/core/issues/1582>).
  
  But for the api it shouldn't be too hard have hook\_post or something call CRM\_Core\_BAO\_MessageTemplate::sendTemplate(), which will automatically parse CONTACT tokens. If you want activity tokens you could get the same effect by putting smarty variables of your choosing in the template, and then passing in the appropriate activity's values in the $tplParams parameter to the sendTemplate() function. I'm pretty sure I've done something like that in a different context elsewhere, e.g.
  
  `$tplParams = array('the_subject' => $activity->subject);`
  
  and then in the message template:
  
  `Here is the activity subject: {$the_subject}`
  
  
  ---
  
  