Orchard Core Omnichannel - Prompt Templates
Configure Omnichannel
You are an Orchard Core expert. Generate code, configuration, and recipes for adding omnichannel communication capabilities to an Orchard Core application using CrestApps modules.
Guidelines
- The base Omnichannel feature (
CrestApps.OrchardCore.Omnichannel) provides shared message storage, contact communication-preference indexing, and communication contracts. It does not itself send SMS or email, place calls, expose an activity UI, or implement channel routing.
- The Managements feature (
CrestApps.OrchardCore.Omnichannel.Managements) adds an admin UI for contacts, activities, activity batches, campaigns, subject flows, dispositions, and channel endpoints under the Interaction Center menu.
- The SMS feature (
CrestApps.OrchardCore.Omnichannel.Sms) enables AI-powered SMS automation. It integrates with the AI Chat module to run AI-driven conversations over SMS using Twilio webhooks.
- The Event Grid feature (
CrestApps.OrchardCore.Omnichannel.EventGrid) receives inbound events through a webhook endpoint. Prefer Microsoft Entra bearer-token delivery; a configured aeg-sas-key is a supported shared-secret alternative.
- The Azure Communication Services feature (
CrestApps.OrchardCore.Omnichannel.AzureCommunicationServices) only declares the dependency bridge to Orchard Core Azure Email and SMS features. It does not add an Omnichannel channel processor or its own ACS settings and routing implementation.
- Omnichannel domain data (messages, activities, batches, AI chat sessions) is stored in a dedicated
Omnichannel YesSql collection.
- Communication preferences (
DoNotCall, DoNotSms, DoNotEmail, DoNotChat) are tracked per contact with UTC timestamps.
- The SMS module validates inbound Twilio requests using HMAC-SHA1 signature verification against the Twilio AuthToken.
- A background task runs every 5 minutes to process automated activities that are scheduled and ready for dispatch.
- Always secure API keys, SAS keys, and Twilio credentials using user secrets or environment variables; never hardcode them.
- Install CrestApps packages in the web/startup project.
Available Omnichannel Features
| Feature |
Feature ID |
Description |
| Omnichannel |
CrestApps.OrchardCore.Omnichannel |
Shared message storage, preferences, indexes, and contracts |
| Azure Communication Services |
CrestApps.OrchardCore.Omnichannel.AzureCommunicationServices |
Dependency bridge for Orchard Core Azure Email and SMS features; not an Omnichannel processor |
| Azure Event Grid |
CrestApps.OrchardCore.Omnichannel.EventGrid |
Webhook endpoint for receiving inbound messages from Azure Event Grid |
| Omnichannel Management |
CrestApps.OrchardCore.Omnichannel.Managements |
Admin UI for contacts, activities, activity batches, campaigns, subject flows, dispositions, and channel endpoints |
| SMS Automation |
CrestApps.OrchardCore.Omnichannel.Sms |
AI-powered SMS channel automation via Twilio with AI chat session integration |
NuGet Packages
| Package |
Description |
CrestApps.OrchardCore.Omnichannel |
Base omnichannel module |
CrestApps.OrchardCore.Omnichannel.EventGrid |
Azure Event Grid webhook handler |
CrestApps.OrchardCore.Omnichannel.Managements |
Contact and activity management UI |
CrestApps.OrchardCore.Omnichannel.Sms |
SMS automation with Twilio and AI |
Supported Channels
The omnichannel system supports the following communication channels:
- SMS - Text messaging via Twilio; the Azure Communication Services feature is currently a placeholder and does not yet provide ACS SMS wiring
- Email - Email communication with contact email tracking
- Phone - Voice call tracking with do-not-call preferences
- Chat - Chat messaging with do-not-chat preferences
Content Types and Parts
| Content Type / Part |
Stereotype |
Description |
OmnichannelContactPart |
Content part |
Attachable contact part; it is not a content-type stereotype |
PhoneNumber |
ContactMethod |
Contact method with Number, Extension, and Type fields |
EmailAddress |
ContactMethod |
Contact method with an Email field |
PhoneNumberInfoPart |
— |
Reusable part with phone number, extension, and type fields |
EmailInfoPart |
— |
Reusable part with an email field |
OmnichannelContactInfoPart |
— |
Contact information part |
Enabling Omnichannel Features via Recipe
Enable the base omnichannel and management features:
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.Omnichannel",
"CrestApps.OrchardCore.Omnichannel.Managements"
],
"disable": []
}
]
}
Enabling SMS Automation via Recipe
Enable SMS automation with AI chat integration. This requires the AI and AI Chat features to be enabled alongside the SMS feature:
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.AI",
"CrestApps.OrchardCore.AI.Chat",
"CrestApps.OrchardCore.Omnichannel",
"CrestApps.OrchardCore.Omnichannel.Managements",
"CrestApps.OrchardCore.Omnichannel.Sms"
],
"disable": []
}
]
}
Enabling Azure Event Grid via Recipe
Enable the Event Grid webhook endpoint for receiving inbound messages from Azure:
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.Omnichannel",
"CrestApps.OrchardCore.Omnichannel.EventGrid"
],
"disable": []
}
]
}
Azure Event Grid Configuration
Configure Event Grid webhook authentication in your shell configuration (appsettings.json):
{
"CrestApps": {
"Omnichannel": {
"EventGrid": {
"EventGridSasKey": "<!-- Your Event Grid SAS Key -->",
"AADIssuer": "<!-- Your AAD Issuer URL -->",
"AADAudience": "<!-- Your AAD Audience -->",
"AADMetadataAddress": "<!-- Your AAD OpenID Metadata Address -->"
}
}
}
}
The webhook endpoint is available at POST Omnichannel/webhook/AzureEventGrid. Prefer Entra bearer-token delivery by configuring AADIssuer, AADAudience, and AADMetadataAddress; it also accepts a configured SAS key in the aeg-sas-key header.
Webhook Endpoints
| Method |
Route |
Module |
Authentication |
| POST |
Omnichannel/webhook/AzureEventGrid |
Event Grid |
SAS key or AAD bearer token |
| POST |
Omnichannel/webhook/Twilio |
SMS |
Twilio HMAC-SHA1 signature |
| POST |
Omnichannel/webhook/TwilioEventGrid |
SMS |
Twilio HMAC-SHA1 signature |
All webhook endpoints are anonymous and do not require antiforgery tokens. They validate authenticity using their respective authentication mechanisms.
AI-Powered SMS Automation
The SMS module integrates with the CrestApps AI Chat module to enable automated SMS conversations:
- Outbound - The
SmsOmnichannelProcessor creates AI chat sessions, renders initial messages using the configured subject flow and AI profile, and sends them via ISmsService.
- Inbound - The
SmsOmnichannelEventHandler receives customer SMS replies, feeds them into the AI chat session as user prompts, runs AI completion, and sends the AI response back as SMS.
- Conclusion Analysis - A deferred task uses AI with the
sms-conclusion-analysis prompt template to determine if the conversation has concluded. When concluded, it auto-sets the disposition and triggers the CompletedActivityEvent workflow event.
Admin UI - Interaction Center
The Managements feature adds an Interaction Center menu in the admin dashboard with the following sections:
- Activities - View and manage omnichannel activities (calls, SMS, emails). Filter by status, channel, campaign, and assignee.
- Activity Batches - Group and manage activities in batches for bulk operations. Batches choose a subject and contacts, then resolve campaign, interaction type, channel, and endpoint from the subject flow when activities are loaded.
- Campaigns - Define campaign names and descriptions used for grouping and reporting.
- Subject Flows - Configure campaign association, interaction type, channel, channel endpoint, and AI settings per
OmnichannelSubject content type.
- Dispositions - Configure unique activity outcome categories (e.g., completed, no answer, callback requested) used by subject actions.
- Channel Endpoints - Manage communication channel endpoints (phone numbers, SMS numbers, email addresses).
Subject Flows and Manage Flow
- A subject is any content type with the
OmnichannelSubject stereotype.
- Subject flow settings live at the subject-content-type level, not the campaign level.
- Campaigns are used for grouping and reporting only; they no longer define channel, interaction type, endpoint, or action logic.
- The Configure screen stores the campaign, interaction type, channel, endpoint, and AI-related settings for the subject.
- The Manage Flow screen stores disposition-driven Subject Actions for that subject.
- Subjects with no actions show a Missing flow badge in the Subject Flows list.
- When the AI feature is enabled, automated subject flows expose a chat AI profile selector plus subject goal and initial outbound prompt pattern fields.
Permissions
| Permission |
Description |
ListActivities |
List all omnichannel activities |
ListContactActivities |
List activities for a specific contact |
CompleteActivity |
Complete any activity |
CompleteOwnActivity |
Complete only own assigned activities |
EditActivity |
Edit activity details |
ManageDispositions |
Manage disposition categories |
ManageCampaigns |
Manage campaigns |
ManageActivityBatches |
Manage activity batches |
ManageChannelEndpoints |
Manage channel endpoints |
By default, the Administrator role has all permissions. The Agent role has ListActivities and ListContactActivities.
Background Processing
The AutomatedActivitiesProcessorBackgroundTask runs on a cron schedule (*/5 * * * *, every 5 minutes). It queries activities with Status = NotStarted and InteractionType = Automated that are scheduled for dispatch (ScheduledUtc <= now), then routes them to the appropriate IOmnichannelProcessor implementation (e.g., SmsOmnichannelProcessor) in batches of 100.
1---2name: orchardcore-omnichannel3description: Skill for configuring Omnichannel communication in Orchard Core using CrestApps modules. Covers subject flows, subject actions, campaigns as grouping/reporting records, activity batches, dispositions, multi-channel messaging (SMS, email, phone, chat), AI-powered automation, Azure Event Grid webhooks, and Twilio integration. Use this skill when requests mention Orchard Core Omnichannel, Subject Flows, Manage Flow, Omnichannel SMS, Contact Management, Channel Endpoints, Communication Preferences, Activity Batches, Campaigns, Dispositions, or related setup and troubleshooting. Strong matches include CrestApps.OrchardCore.Omnichannel, CrestApps.OrchardCore.Omnichannel.Managements, CrestApps.OrchardCore.Omnichannel.Sms, CrestApps.OrchardCore.Omnichannel.EventGrid, OmnichannelContactPart, SubjectFlowSettings, SubjectAction, IOmnichannelProcessor, plus the code patterns, admin flows, recipe steps, and referenced examples captured in this skill.4license: Apache-2.05---67# Orchard Core Omnichannel - Prompt Templates89## Configure Omnichannel1011You are an Orchard Core expert. Generate code, configuration, and recipes for adding omnichannel communication capabilities to an Orchard Core application using CrestApps modules.1213### Guidelines1415- The base Omnichannel feature (`CrestApps.OrchardCore.Omnichannel`) provides shared message storage, contact communication-preference indexing, and communication contracts. It does not itself send SMS or email, place calls, expose an activity UI, or implement channel routing.16- The Managements feature (`CrestApps.OrchardCore.Omnichannel.Managements`) adds an admin UI for contacts, activities, activity batches, campaigns, subject flows, dispositions, and channel endpoints under the **Interaction Center** menu.17- The SMS feature (`CrestApps.OrchardCore.Omnichannel.Sms`) enables AI-powered SMS automation. It integrates with the AI Chat module to run AI-driven conversations over SMS using Twilio webhooks.18- The Event Grid feature (`CrestApps.OrchardCore.Omnichannel.EventGrid`) receives inbound events through a webhook endpoint. Prefer Microsoft Entra bearer-token delivery; a configured `aeg-sas-key` is a supported shared-secret alternative.19- The Azure Communication Services feature (`CrestApps.OrchardCore.Omnichannel.AzureCommunicationServices`) only declares the dependency bridge to Orchard Core Azure Email and SMS features. It does not add an Omnichannel channel processor or its own ACS settings and routing implementation.20- Omnichannel domain data (messages, activities, batches, AI chat sessions) is stored in a dedicated `Omnichannel` YesSql collection.21- Communication preferences (`DoNotCall`, `DoNotSms`, `DoNotEmail`, `DoNotChat`) are tracked per contact with UTC timestamps.22- The SMS module validates inbound Twilio requests using HMAC-SHA1 signature verification against the Twilio AuthToken.23- A background task runs every 5 minutes to process automated activities that are scheduled and ready for dispatch.24- Always secure API keys, SAS keys, and Twilio credentials using user secrets or environment variables; never hardcode them.25- Install CrestApps packages in the web/startup project.2627### Available Omnichannel Features2829| Feature | Feature ID | Description |30|---------|-----------|-------------|31| Omnichannel | `CrestApps.OrchardCore.Omnichannel` | Shared message storage, preferences, indexes, and contracts |32| Azure Communication Services | `CrestApps.OrchardCore.Omnichannel.AzureCommunicationServices` | Dependency bridge for Orchard Core Azure Email and SMS features; not an Omnichannel processor |33| Azure Event Grid | `CrestApps.OrchardCore.Omnichannel.EventGrid` | Webhook endpoint for receiving inbound messages from Azure Event Grid |34| Omnichannel Management | `CrestApps.OrchardCore.Omnichannel.Managements` | Admin UI for contacts, activities, activity batches, campaigns, subject flows, dispositions, and channel endpoints |35| SMS Automation | `CrestApps.OrchardCore.Omnichannel.Sms` | AI-powered SMS channel automation via Twilio with AI chat session integration |3637### NuGet Packages3839| Package | Description |40|---------|-------------|41| `CrestApps.OrchardCore.Omnichannel` | Base omnichannel module |42| `CrestApps.OrchardCore.Omnichannel.EventGrid` | Azure Event Grid webhook handler |43| `CrestApps.OrchardCore.Omnichannel.Managements` | Contact and activity management UI |44| `CrestApps.OrchardCore.Omnichannel.Sms` | SMS automation with Twilio and AI |4546### Supported Channels4748The omnichannel system supports the following communication channels:4950- **SMS** - Text messaging via Twilio; the Azure Communication Services feature is currently a placeholder and does not yet provide ACS SMS wiring51- **Email** - Email communication with contact email tracking52- **Phone** - Voice call tracking with do-not-call preferences53- **Chat** - Chat messaging with do-not-chat preferences5455### Content Types and Parts5657| Content Type / Part | Stereotype | Description |58|---------------------|-----------|-------------|59| `OmnichannelContactPart` | Content part | Attachable contact part; it is not a content-type stereotype |60| `PhoneNumber` | `ContactMethod` | Contact method with Number, Extension, and Type fields |61| `EmailAddress` | `ContactMethod` | Contact method with an Email field |62| `PhoneNumberInfoPart` | — | Reusable part with phone number, extension, and type fields |63| `EmailInfoPart` | — | Reusable part with an email field |64| `OmnichannelContactInfoPart` | — | Contact information part |6566### Enabling Omnichannel Features via Recipe6768Enable the base omnichannel and management features:6970```json71{72 "steps": [73 {74 "name": "Feature",75 "enable": [76 "CrestApps.OrchardCore.Omnichannel",77 "CrestApps.OrchardCore.Omnichannel.Managements"78 ],79 "disable": []80 }81 ]82}83```8485### Enabling SMS Automation via Recipe8687Enable SMS automation with AI chat integration. This requires the AI and AI Chat features to be enabled alongside the SMS feature:8889```json90{91 "steps": [92 {93 "name": "Feature",94 "enable": [95 "CrestApps.OrchardCore.AI",96 "CrestApps.OrchardCore.AI.Chat",97 "CrestApps.OrchardCore.Omnichannel",98 "CrestApps.OrchardCore.Omnichannel.Managements",99 "CrestApps.OrchardCore.Omnichannel.Sms"100 ],101 "disable": []102 }103 ]104}105```106107### Enabling Azure Event Grid via Recipe108109Enable the Event Grid webhook endpoint for receiving inbound messages from Azure:110111```json112{113 "steps": [114 {115 "name": "Feature",116 "enable": [117 "CrestApps.OrchardCore.Omnichannel",118 "CrestApps.OrchardCore.Omnichannel.EventGrid"119 ],120 "disable": []121 }122 ]123}124```125126### Azure Event Grid Configuration127128Configure Event Grid webhook authentication in your shell configuration (`appsettings.json`):129130```json131{132 "CrestApps": {133 "Omnichannel": {134 "EventGrid": {135 "EventGridSasKey": "<!-- Your Event Grid SAS Key -->",136 "AADIssuer": "<!-- Your AAD Issuer URL -->",137 "AADAudience": "<!-- Your AAD Audience -->",138 "AADMetadataAddress": "<!-- Your AAD OpenID Metadata Address -->"139 }140 }141 }142}143```144145The webhook endpoint is available at `POST Omnichannel/webhook/AzureEventGrid`. Prefer Entra bearer-token delivery by configuring `AADIssuer`, `AADAudience`, and `AADMetadataAddress`; it also accepts a configured SAS key in the `aeg-sas-key` header.146147### Webhook Endpoints148149| Method | Route | Module | Authentication |150|--------|-------|--------|---------------|151| POST | `Omnichannel/webhook/AzureEventGrid` | Event Grid | SAS key or AAD bearer token |152| POST | `Omnichannel/webhook/Twilio` | SMS | Twilio HMAC-SHA1 signature |153| POST | `Omnichannel/webhook/TwilioEventGrid` | SMS | Twilio HMAC-SHA1 signature |154155All webhook endpoints are anonymous and do not require antiforgery tokens. They validate authenticity using their respective authentication mechanisms.156157### AI-Powered SMS Automation158159The SMS module integrates with the CrestApps AI Chat module to enable automated SMS conversations:1601611. **Outbound** - The `SmsOmnichannelProcessor` creates AI chat sessions, renders initial messages using the configured subject flow and AI profile, and sends them via `ISmsService`.1622. **Inbound** - The `SmsOmnichannelEventHandler` receives customer SMS replies, feeds them into the AI chat session as user prompts, runs AI completion, and sends the AI response back as SMS.1633. **Conclusion Analysis** - A deferred task uses AI with the `sms-conclusion-analysis` prompt template to determine if the conversation has concluded. When concluded, it auto-sets the disposition and triggers the `CompletedActivityEvent` workflow event.164165### Admin UI - Interaction Center166167The Managements feature adds an **Interaction Center** menu in the admin dashboard with the following sections:1681691. **Activities** - View and manage omnichannel activities (calls, SMS, emails). Filter by status, channel, campaign, and assignee.1702. **Activity Batches** - Group and manage activities in batches for bulk operations. Batches choose a subject and contacts, then resolve campaign, interaction type, channel, and endpoint from the subject flow when activities are loaded.1713. **Campaigns** - Define campaign names and descriptions used for grouping and reporting.1724. **Subject Flows** - Configure campaign association, interaction type, channel, channel endpoint, and AI settings per `OmnichannelSubject` content type.1735. **Dispositions** - Configure unique activity outcome categories (e.g., completed, no answer, callback requested) used by subject actions.1746. **Channel Endpoints** - Manage communication channel endpoints (phone numbers, SMS numbers, email addresses).175176### Subject Flows and Manage Flow177178- A subject is any content type with the `OmnichannelSubject` stereotype.179- Subject flow settings live at the subject-content-type level, not the campaign level.180- Campaigns are used for grouping and reporting only; they no longer define channel, interaction type, endpoint, or action logic.181- The **Configure** screen stores the campaign, interaction type, channel, endpoint, and AI-related settings for the subject.182- The **Manage Flow** screen stores disposition-driven **Subject Actions** for that subject.183- Subjects with no actions show a **Missing flow** badge in the Subject Flows list.184- When the AI feature is enabled, automated subject flows expose a chat AI profile selector plus subject goal and initial outbound prompt pattern fields.185186### Permissions187188| Permission | Description |189|-----------|-------------|190| `ListActivities` | List all omnichannel activities |191| `ListContactActivities` | List activities for a specific contact |192| `CompleteActivity` | Complete any activity |193| `CompleteOwnActivity` | Complete only own assigned activities |194| `EditActivity` | Edit activity details |195| `ManageDispositions` | Manage disposition categories |196| `ManageCampaigns` | Manage campaigns |197| `ManageActivityBatches` | Manage activity batches |198| `ManageChannelEndpoints` | Manage channel endpoints |199200By default, the **Administrator** role has all permissions. The **Agent** role has `ListActivities` and `ListContactActivities`.201202### Background Processing203204The `AutomatedActivitiesProcessorBackgroundTask` runs on a cron schedule (`*/5 * * * *`, every 5 minutes). It queries activities with `Status = NotStarted` and `InteractionType = Automated` that are scheduled for dispatch (`ScheduledUtc <= now`), then routes them to the appropriate `IOmnichannelProcessor` implementation (e.g., `SmsOmnichannelProcessor`) in batches of 100.