Delivery
The Delivery page in the application allows users to configure and manage delivery methods, primarily for sending out information via SMS or email. These configurations can then be used by AI agents or automation flows.
Overview
The page provides functionalities to:
- Add new delivery configurations.
- List existing delivery configurations, filtered by the selected agent.
- Edit existing delivery configurations.
- Associate delivery configurations with specific agents.
- Delete delivery configurations.
Adding a New Delivery
To add a new delivery configuration:
- Navigate to the Delivery page.
- Expand the "New Delivery" section.
- A form will appear with the following fields:
- Lookup Names: (Button) Opens a dialog for looking up existing names of variables, prompts, APIs, etc., which can be useful when configuring delivery messages or parameters.
- Name: (Text Input) A unique and descriptive name for this delivery configuration (e.g., "OrderConfirmationSMS", "NewsletterEmail").
- Status: (Toggle) Activates or deactivates this delivery configuration. Default is
True
(active). - Agent(s): (Multiselect) Select one or more agents that will be able to use this delivery configuration.
- Type: (Selectbox) The type of delivery. Options:
sms
,email
. - Method: (Selectbox) The service or method used for delivery. Options:
Infobip
,Microsoft Graph API
,Twilio
,SendGrid
. - Connector: (Selectbox) An optional OAuth Connector to use for generating authentication tokens for the delivery method (e.g., for Microsoft Graph API or Infobip).
- To: (Text Input) The recipient's address (phone number for SMS, email address for email). Supports embedding variables using
{var["variableName"]}
. - From: (Text Input) The sender's address (phone number for SMS, email address for email). Supports embedding variables.
- CC: (Text Input) For email type only. Carbon Copy recipients. Supports embedding variables.
- BCC: (Text Input) For email type only. Blind Carbon Copy recipients. Supports embedding variables.
- Subject: (Text Input) For email type only. The subject line of the email. Supports embedding variables.
- Body: (Text Area) The main content of the message (SMS text or email body). Supports embedding variables.
- Opt Out: (Text Area) Text for opt-out instructions or links. Supports embedding variables.
- Reply To: (Text Input) For email type only. The email address to which replies should be sent. Supports embedding variables.
- Attachment Path: (Text Input) For email type only. Path to a file to be attached. Supports embedding variables.
- Delivery Response Message: (Text Area) An optional message to return after the delivery is sent. If provided, this is considered a final response. Supports embedding variables.
- Click the "Create Delivery" button.
- Upon submission, the system stores the delivery configuration.
Listing Deliveries
Existing delivery configurations are listed under the "Deliveries" subheader.
- Filtering: The list is automatically filtered to display deliveries associated with the globally selected agent (if an agent is selected).
- Display: Each delivery configuration is shown in an expandable section, displaying its name, status (✅ for active, ❌ for inactive), and associated agents.
- Details: Expanding a delivery's section reveals:
- Type (sms/email)
- Method
- Connector (if used)
- To address
- From address
- Subject (for email)
- Delivery Response (if configured)
- Each delivery entry has "Edit" and "Delete" buttons.
Editing a Delivery
To edit an existing delivery configuration:
- Click the "Edit" button next to the desired delivery in the list.
- The "Edit [Delivery Name]" form will appear, pre-filled with the delivery's current information.
- All fields from the "Add Delivery" form are available for modification. Additionally:
- Lookup Names: (Button) Available for looking up system names.
- Add Variable: (Button) Opens a dialog to quickly add a new variable if needed during configuration.
- Click "Save Changes" to update the delivery or "Cancel" to discard changes and hide the edit form.
Adding an Agent to a Delivery
If an agent is selected (via the global agent selector), a section appears allowing you to associate existing delivery configurations (that are not already associated with the selected agent) to that agent.
- A dropdown lists "Available deliveries for [Selected Agent Name] Agent:".
- Select a delivery configuration and click "Include delivery" to add the selected agent to that delivery's
delivery_agents
list.
Deleting a Delivery
To delete a delivery configuration:
- Click the "Delete" button next to the desired delivery in the list.
- Confirm the deletion when prompted. The delivery configuration will be permanently removed from the database.
This documentation should provide a good understanding of how to use the Delivery page.
Quick Help - Delivery Configuration
Example: Emailing a Stock Report
This example shows how to configure a delivery to email a generated stock analysis report to a user.
- Name:
stock report
- Type:
email
- Method:
Microsoft Graph API
- Connector:
Microsoft-Graph-API
- To:
{var["email"]}
- From:
alan@pinionai.com
- Subject:
{var["first_name"]} - Your AI stock report
- Body:
<p>
Dear {var["first_name"]},<br />
Thanks for your interest in pinionai.com.<br />
Here is your report
</p>
<p>{var["stock_analysis_response"]}</p>
Setup: Configuring Microsoft Graph API for Email
The most modern and robust way to interact with an Outlook account is through the Microsoft Graph API. It's more secure than older methods because it uses OAuth 2.0 for authentication instead of just a username and password.
To register a Microsoft Graph API Application in Azure, you need to tell Microsoft that you have an application that wants to use its services.
- Go to the Azure Portal and sign in with your Microsoft account.
- Search for and select "Azure Active Directory".
- Go to "App registrations" and click "+ New registration".
- Name: Give it a name, like
MyWebsiteEmailer
. - Supported account types: Choose "Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)".
- Click "Register".
- Take note of these two values on the overview page. You'll need them later:
Application (client) ID
Directory (tenant) ID
(If you didn't note these, you can always find them by going to Azure Active Directory -> App registrations, clicking on your app, and viewing the "Overview" page.)
- Go to "Certificates & secrets".
- Click "+ New client secret". Give it a description (e.g.,
website-secret
) and an expiration. - IMPORTANT: Copy the Value of the secret immediately. You will never see it again after you leave this page.
- Go to "API permissions".
- Click "+ Add a permission", select "Microsoft Graph".
- Select "Application permissions" (NOT delegated permissions, because your server is acting on its own behalf).
- Search for
Mail.Send
and check the box next toMail.Send
. - Click "Add permissions".
- Finally, you must click the "Grant admin consent for [Your Directory Name]" button and click "Yes". The status should change to "Granted".