Orchardcore omnichannel

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore omnichannel is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for the CrestApps Orchard Core Omnichannel base module and the map of the Omnichannel module family. Covers the CrestApps.OrchardCore.Omnichannel feature (shared OmnichannelMessage store in the Omnichannel YesSql collection, IOmnichannelProcessor and IOmnichannelEventHandler contracts, Omnicha

How to use this skill

Skill file

Orchard Core Omnichannel (Base Module)

Choose and Enable Omnichannel Features

You are an Orchard Core expert. Use this skill to pick the right Omnichannel

feature and to build on the shared contracts that every Omnichannel channel

uses. The base feature is plumbing: it stores messages and preferences and

defines contracts. It sends nothing, places no calls and has no admin screens.

Guidelines

other Omnichannel feature through dependencies; you rarely enable it alone.

stored in the dedicated Omnichannel YesSql collection

(OmnichannelConstants.CollectionName).

channel or provider feature that owns the webhook.

the tenant database. Protect them with database or disk encryption and treat

them as personal data.

never in recipes or source.

Feature Map

| Need | Feature ID | Skill |

|---|---|---|

| Shared message store, preferences, contracts | CrestApps.OrchardCore.Omnichannel | this skill |

| Azure Communication Services email and SMS providers | CrestApps.OrchardCore.Omnichannel.AzureCommunicationServices | this skill |

| Headless contacts, subjects, campaigns, activities | CrestApps.OrchardCore.Omnichannel.Activities | orchardcore-omnichannel-management |

| Omnichannel addresses (channel endpoints) admin | CrestApps.OrchardCore.Omnichannel.ChannelEndpoints (dependency only) | orchardcore-omnichannel-management |

| CRM admin, loads, subject flows, cadences, reports | CrestApps.OrchardCore.Omnichannel.Managements | orchardcore-omnichannel-management |

| Leads, accounts, opportunities | CrestApps.OrchardCore.Omnichannel.Crm | orchardcore-omnichannel-management |

| AI-driven SMS conversations | CrestApps.OrchardCore.Omnichannel.Sms | orchardcore-omnichannel-sms |

| AI-driven voice calls (provider neutral) | CrestApps.OrchardCore.Omnichannel.Voice | orchardcore-omnichannel-voice |

| Human messaging inbox | CrestApps.OrchardCore.Omnichannel.Messaging | orchardcore-omnichannel-messaging |

| SMS channel of the inbox | CrestApps.OrchardCore.Omnichannel.Messaging.Sms | orchardcore-omnichannel-messaging |

| Push routing for the inbox | CrestApps.OrchardCore.Omnichannel.Messaging.RoutedDistribution | orchardcore-omnichannel-messaging |

| Messaging pictures in Azure Blob Storage | CrestApps.OrchardCore.Omnichannel.Messaging.Azure | orchardcore-omnichannel-messaging |

| Azure Event Grid inbound webhook | CrestApps.OrchardCore.Omnichannel.EventGrid | orchardcore-omnichannel-event-grid |

Related skills owned elsewhere: orchardcore-contact-center (queues, entry

points, agents, dialer), orchardcore-business-hours (the Business Hours

schedules that gate queues, loads and cadences), orchardcore-telephony,

orchardcore-telephony-telnyx (Telnyx SMS and the Telnyx AI Voice Agent),

orchardcore-telephony-asterisk, orchardcore-dnc-registry,

orchardcore-phone-numbers, orchardcore-signalr, and the framework skills

orchardcore-sms and orchardcore-sms-azure.

Enable via Recipe

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.Omnichannel",
        "CrestApps.OrchardCore.Omnichannel.Managements"
      ],
      "disable": []
    }
  ]
}

Azure Communication Services

CrestApps.OrchardCore.Omnichannel.AzureCommunicationServices (**Omnichannel -

Azure Communication Services**) depends on CrestApps.OrchardCore.Omnichannel,

OrchardCore.Email.Azure and OrchardCore.Sms.Azure. It adds no settings,

connection-string model or processor of its own: it switches on Orchard Core's

ACS email and SMS providers so Omnichannel components can send through the

standard ISmsService and email services.

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.Omnichannel.AzureCommunicationServices"
      ],
      "disable": []
    }
  ]
}

After enabling it:

  1. Configure the Azure email provider at Settings > Communication > Email.
  2. Configure the Azure SMS provider at Settings > Communication > SMS.

Enabling the feature does not change a tenant's selected default provider.

  1. Enable a consumer: SMS Omnichannel Automation for AI SMS, or the **SMS

Messaging Channel**, whose SMS addresses can pin the Azure provider per number.

  1. For inbound ACS texts, enable Omnichannel - Azure Event Grid and subscribe

it to the ACS resource's SMS events. Microsoft.Communication.SMSReceived is

routed as an SMS inbound text; Microsoft.Communication.SMSDeliveryReportReceived

is stored but not routed (the sent message's status is not updated). The ACS

number must exist as an SMS omnichannel address so the event matches it.

Inbound Webhook Map

| Provider path | Endpoint | Owning feature |

|---|---|---|

| Azure Event Grid (including ACS SMS) | POST ~/api/azure/webhook/eventgrid | CrestApps.OrchardCore.Omnichannel.EventGrid |

| Twilio inbound SMS | POST ~/api/twilio/webhook/sms | CrestApps.OrchardCore.Omnichannel.Sms or CrestApps.OrchardCore.Omnichannel.Messaging.Sms (mapped once when both are on); refused while the Twilio provider is disabled in the SMS settings |

| Telnyx inbound SMS | POST ~/api/telnyx/webhook/sms | Telnyx SMS (orchardcore-telephony-telnyx) |

Every SMS receiver raises the same OmnichannelConstants.Events.SmsReceived

event on the SMS channel, so SMS Automation and the SMS Messaging Channel act

on Twilio, Telnyx and ACS texts identically. Both SMS features depend on the

dependency-only Provider Webhook Inbox

(CrestApps.OrchardCore.ContactCenter.ProviderInbox, shipped by the

CrestApps.OrchardCore.Webhooks module): each receiver commits the text to it,

keyed on the provider message id, before answering the provider, so a restart

loses nothing and redeliveries are absorbed on every node.

Whether a person may be contacted on a channel is answered by the shared

IConsentService (CrestApps.OrchardCore.Consent); see

orchardcore-omnichannel-management.

Shared Contracts

All types are in CrestApps.OrchardCore.Omnichannel.Core (models in

CrestApps.OrchardCore.Omnichannel.Core.Models, services in

CrestApps.OrchardCore.Omnichannel.Core.Services).

| Type | Purpose |

|---|---|

| IOmnichannelProcessor | Starts an automated activity on one channel (Channel, StartAsync(activity, cancellationToken)). SMS Automation registers SMS; Telnyx AI Voice registers Phone. |

| IOmnichannelEventHandler | Receives every inbound OmnichannelEvent (HandleAsync(event, cancellationToken)). |

| OmnichannelEvent | Id, EventType, Subject, Message, Data (BinaryData) and GetDataFromJson<T>(). |

| OmnichannelMessage | Stored message: Channel, CustomerAddress, ServiceAddress, Content, IsInbound, ConversationId, ProviderMessageId, DeliveryStatus, MediaReferences, ErrorCode. |

| IOmnichannelHandoffAvailability | Optional companion of IOmnichannelHandoffService: GetAvailabilityAsync(queueId) returns HandoffAvailability (Open, CallbackOnly, Unavailable) so an automated conversation is offered a transfer only when someone can take it. Contact Center implements it. |

| ISmsProviderRouter | Resolves the SMS provider that owns a sending number (ResolveProviderNameAsync, GetProviderAsync, SendAsync), falling back to the tenant default. |

| OmnichannelConstants.Channels | Phone, SMS, Email. |

| OmnichannelConstants.SmsErrorCodes | Provider-neutral refusals such as recipient_opted_out and media_not_supported. |

Handle an Inbound Event

Every handler is called for every event, so filter by event type, channel and

direction before acting, and keep side effects idempotent because providers

retry.

using CrestApps.OrchardCore.Omnichannel.Core;
using CrestApps.OrchardCore.Omnichannel.Core.Models;

namespace MyCompany.OrchardCore.Communications;

public sealed class ProviderReceiptHandler : IOmnichannelEventHandler
{
    public Task HandleAsync(OmnichannelEvent omnichannelEvent, CancellationToken cancellationToken = default)
    {
        if (!string.Equals(omnichannelEvent.EventType, "Contoso.MessageDelivered", StringComparison.Ordinal))
        {
            return Task.CompletedTask;
        }

        // Read the provider payload with omnichannelEvent.GetDataFromJson<T>().
        return Task.CompletedTask;
    }
}

Register it in the owning feature's startup with

services.AddScoped<IOmnichannelEventHandler, ProviderReceiptHandler>();.

Add an Automated Channel Processor

using CrestApps.OrchardCore.Omnichannel.Core;
using CrestApps.OrchardCore.Omnichannel.Core.Models;

namespace MyCompany.OrchardCore.Communications;

public sealed class WhatsAppOmnichannelProcessor : IOmnichannelProcessor
{
    public string Channel => "WhatsApp";

    public Task StartAsync(OmnichannelActivity activity, CancellationToken cancellationToken)
    {
        // Send the opening message for the automated activity.
        return Task.CompletedTask;
    }
}

Register with

services.TryAddEnumerable(ServiceDescriptor.Scoped<IOmnichannelProcessor, WhatsAppOmnichannelProcessor>());

and also register the channel in ActivityChannelOptions (see

orchardcore-omnichannel-management) so loads and filters offer it. The

management feature's AutomatedActivitiesProcessorBackgroundTask dispatches

due automated activities to the processor whose Channel matches.

Upgrading from 2.x

api/azure/webhook/eventgrid and Twilio at api/twilio/webhook/sms. The old

Omnichannel/webhook/AzureEventGrid, Omnichannel/webhook/Twilio and

Omnichannel/webhook/TwilioEventGrid routes are gone.

DoNotSms and DoNotEmail.

(see orchardcore-omnichannel-management), not by walking the

ContactMethods bag.

messaging hub is mapped with SignalRHubRoutes.GetHubPath<T>() (see

orchardcore-signalr).

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.