This endpoint allows you to send a test marketing email to a list of email addresses.
Before sending a marketing message, you can test it using this endpoint. You may specify up to 10 contacts in the emails
request body field. You must also specify a template_id
and include either a from_address
or sender_id
. You can manage your templates with the Twilio SendGrid App or the Transactional Templates API.
Please note that this endpoint works with Dynamic Transactional Templates only. Legacy Transactional Templates will not be delivered.
For more information about managing Dynamic Transactional Templates, see How to Send Email with Dynamic Transactional Templates.
You can also test your Single Sends in the Twilio SendGrid Marketing Campaigns UI.
Bearer <<YOUR_API_KEY_HERE>>
application/json
The ID of the template that you would like to use. If you use a template that contains a subject and content (either text or HTML), then those values specified at the personalizations or message level will not be used.
You can override the active template with an alternative template version by passing the version ID in this field. If this field is blank, the active template version will be used.
This ID must belong to a verified sender. Alternatively, you may supply a from_address
email.
A custom unsubscribe URL.
An array of email addresses you want to send the test message to.
You can either specify this address or specify a verified sender ID.
No properties defined
1const client = require('@sendgrid/client');2client.setApiKey(process.env.SENDGRID_API_KEY);34const data = {5"template_id": "f8f77db8-b9fa-4b3c-9ee8-de3d582016b8",6"version_id_override": "7734f757-8eb8-4d22-b7f0-779a72f32986",7"sender_id": 6060664,8"custom_unsubscribe_url": "https://example.com/unsubscribe",9"suppression_group_id": 21865513,10"emails": [11"janedoe@example.com",12"tiramisu@example.com",13"bundt@example.com"14]15};1617const request = {18url: `/v3/marketing/test/send_email`,19method: 'POST',20body: data21}2223client.request(request)24.then(([response, body]) => {25console.log(response.statusCode);26console.log(response.body);27})28.catch(error => {29console.error(error);30});