
Set Template, To/From Emails, whether to include transcript as a pdf in email and whether or not to send an email for every interaction regardless of what occurs in the interaction.

Make sure to reference the exact variable name and to save the information in interaction_metadata when captured.


Setting up the SendGrid integration in the Portal
Go to “Integrations” in the left-hand side bar.
Click the “SendGrid V2” integration under “Available”.

Paste the API key copied from your SendGrid account into the “Submit API Key” box.
Click the “Submit API Key” button.

Email Template Configuration in the Portal
Choose your template which you have created from the drop-down box.
Type your chosen “From Email” (i.e. the address the call log will be sent from).
Type your chosen “To Email” (i.e. the address(es) the call log will be sent to). These will need to be separated by commas, without spaces.
Tick “Include call transcript in email” depending on whether you want the email to include the transcript.
Template Variables
The variables included in the template are listed out here, informing users which variables may need to be referenced in the agent prompt.
Click the “Save Changes” button.

Correct formatting of “To Email” addresses:

Incorrect formatting of “To Email” addresses:

Selecting the SendGrid integration for an agent
When editing an agent, click the “Integrations” drop down box.
Tick “SendGrid V2”.
Click “Save Agent”.

Agent Prompt
As well as triggering the SendGrid tool, you will also need to detail what information needs collecting when you are capturing any piece of information, ensuring the information is saved into the relevant variable e.g. “customer_name” depending on the email template used.
Use example below and place at the beginning of the prompt: (Under your agent's name, Goal etc)
Please note below will need updated based on the information you are collecting.
| #Sendgrid tool: You have access to SendGrid email sending services. Use the SENDGRID_EMAIL_V2 function to send emails on behalf of users. |
|---|
Update your call flow prompt to incorporate below example where relevant.
You will need to amend the variables to your use case and ensure the variables are written exactly as is on your template, (it is case sensitive) which you can see in point 6 above.
"callers name" will be replaced with the 1st line in your call flow. For example if collecting “call reason” this will replace “callers name”
| You have access to SendGrid email sending services. Use the SENDGRID_EMAIL_V2 function to send emails on behalf of users. 1. Greet: Welcome to [Insert company name]. Identify as [Insert agent name], You are an AI Voice Agent. 2. Ask for caller's name and when they give it, save it in interaction_metadata as customer_name (do not mention this) and Immediately use the sendgrid tool to request the email. 3. Verify Number: Use the get_metadata tool for the current number. Say 'I assume the number you have called us from is the best to use. Is that correct?' Add the CLI number into the "phone_number" Get back to caller straightaway. 4. Ask for caller's email and when they give it, save it in interaction_metadata as email_address (do not mention this) and Immediately use the sendgrid tool to request the email 5. Send Transcript: Immediately use the SendGrid tool to send this information(do not mention this) then proceed to next step. 6. Capture Reason: Ask why they are calling, and when they tell you save this information in interaction_metadata as call_reason (do not mention this). 7. Close: Confirm details are captured, call the "SendGridEmailV2__SendgridV2" tool in order to send an email to the team, and advise a team member will call back. # METADATA STREAMING (BACKGROUND) As values are gathered, submit to interaction_metadata: - call_summary - Customer Provided - customer_name - Customer Provided - phone_number - Customer Provided or metadata -email_address - Customer Provided Send via SendGrid immediately. Do NOT wait for all fields. |
|---|
When the email needs to be sent in a certain scenario and not for all calls, and the information has already been gathered:
IF YOU ARE UPDATING A PHONE AGENT, UNDEPLOY AND DEPLOY AGAIN
Please Note:
Ensure the correct variables are included and written in the same way as you have in your email template
e.g. use the "phone_number" field name, with the underscore included, and not just "Phone Number".
e.g. if the email template uses "phone_number", it will not work if "telephone_number" is used.
The above prompts are the recommended starting point for a basic agent. If you have a complex agent with integrations, this prompt will need testing and updating for the use case.
Updated guidance (current SendGrid V2 support article): the recommended prompt pattern has simplified — rather than instructing the agent to call the SendGrid tool after each individual field is collected, current guidance is to gather all the required details first, save each to its interaction_metadata variable as it's collected (without mentioning this to the caller), and only trigger the SendGrid tool once, after everything needed has been gathered. Also explicitly instruct the agent to never summarise the captured details back to the caller on the call itself.
If you require support, please contact your provider.
Important Details
Call summaries sent via an email to recipients can be triggered at any point in a call, regardless of time.
Details can be submitted into the metadata as a separate action to the email trigger.
Both of these capabilities are available across all agent types, now including Web Text agents.
Example of successful tool call saving contact details:

The Always Send tick-box sends the configured SendGrid email for every interaction by default. It replaces the need for the agent to call the SendGrid tool during the conversation, while still allowing live variables to populate email content when they are collected.
Q: What does the Always Send tick-box do?
A: It uses the same functionality to send email after the call as when the agent calls SendGrid tool, but the agent no longer needs to call the tool.
Q: Should the SendGrid tool call remain in the prompt?
A: No. Remove the instruction that tells the agent to call the SendGrid tool. Keep only the instructions that collect and add required information to live variables.
Q: When is the email sent?
A: The email is sent when the call or interaction ends. If the normal end event does not occur, it is sent on timeout instead.
Q: Will Always Send appear in transcripts as a tool call?
A: No. Because the email is triggered by integration configuration, it will not appear in transcripts as a SendGrid tool call.
Q: What happens if the prompt still tries to call the tool?
A: It is expected to return the same "tool had already been called" style response seen previously.
Q: Which channels does it support?
A: It is expected to work for text interactions as well as web, telephone, and extension voice interactions.
Q: Are very short calls included?
A: Yes. Emails are currently sent for every call, including calls under five seconds. A cutoff is being worked on so hang-ups and silent calls do not create excess emails.
Q: What is included in the email if variables are not used?
A: If no variables are included, the customer receives an email with the transcript. If variables are included and populated during the call, the email includes those variables.