From 6d791adfd7a5048cd43fff6438f435d6125bd2ea Mon Sep 17 00:00:00 2001 From: Sasha Malcolmson <64798484+amalco2@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:41:28 -0400 Subject: [PATCH] Update cc-bcc-with-rest-api.md (#777) * Update cc-bcc-with-rest-api.md Adding details on using CC and BCC with stored templates. * Update content/docs/faq/cc-bcc-with-rest-api.md Co-authored-by: Matt Gray <40871530+mtgray-sp@users.noreply.github.com> * Update content/docs/faq/cc-bcc-with-rest-api.md Co-authored-by: Matt Gray <40871530+mtgray-sp@users.noreply.github.com> --------- Co-authored-by: Matt Gray <40871530+mtgray-sp@users.noreply.github.com> --- content/docs/faq/cc-bcc-with-rest-api.md | 76 +++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/content/docs/faq/cc-bcc-with-rest-api.md b/content/docs/faq/cc-bcc-with-rest-api.md index b189cfa1..31e27b4b 100644 --- a/content/docs/faq/cc-bcc-with-rest-api.md +++ b/content/docs/faq/cc-bcc-with-rest-api.md @@ -1,5 +1,5 @@ --- -lastUpdated: "02/08/2020" +lastUpdated: "10/16/2024" title: "Using CC and BCC with the REST API" description: "Before getting started please read What are the differences between CC BCC and archive recipients Note to use CC BCC and Archiving with SMTP check out our SMTP API reference documentation Note Please be advised that CC and BCC messages count towards your usage What is CC CC is a..." --- @@ -124,3 +124,77 @@ Finally, here's an example with both CC and BCC recipients.  You set header_to } } ``` + +### Using CC and BCC with Stored Templates + +Header values must be set directly within the stored template, so manually adding CC and BCC will not be honored when a stored template is used. To use CC and BCC with a stored template, the template must be created through the API. + +One method is to use substitution data for your templates that you want to have a CC line. For example, you could create a template like this: + +```json +{ + "id": "cc_template_3", + "name": "cc_template_3", + "description": "", + "published": true, + "options": { + "click_tracking": true, + "open_tracking": false + }, + "shared_with_subaccounts": false, + "last_update_time": "2018-12-14T17:15:12+00:00", + "last_use": "2018-12-14T17:15:49+00:00", + "has_published": true, + "has_draft": false, + "content": { + "from": "you@fromyou.com", + "headers": { + "CC": "{{ cc_data or '' }}" + }, + "subject": "CC 2", + "text": " cc email" + } +} +``` + +Then, for the transmission, set the substitution data for the CC: + +```json +{ + "options": { + "open_tracking": true, + "click_tracking": true, + "transactional": true + }, + "campaign_id": "mycampaign-msys", + "return_path": "you@bounce.fromyou.com", + "header_from": "Single Recipient", + "metadata": { + "key": "value" + }, + "recipients": [ + { + "address": { + "email": "to@thisperson.com" + }, + "tags": [ + "greeting", + "prehistoric", + "fred", + "flintstone" + ], + "header_to": "Wilma Flintstone", + "metadata": { + "place": "Bedrock", + "host": "google.com" + } + } + ], + "substitution_data": { + "cc_data": "cc@thatperson.com" + }, + "content": { + "template_id": "cc_template_3" + } +} +```