web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / How can i get on Conv...
Copilot Studio
Unanswered

How can i get on Conversation start message in C#

(0) ShareShare
ReportReport
Posted on by 6

Hi Team,

I would like to receive the initial conversation start message created in Copilot Studio in C#. We use the DirectLineClient object to get the default message, but I'm not getting the conversation start message with the code below. The client.Conversations.GetActivitiesAsync(conversationId, watermark) call always returns null.

// Initialize Direct Line client
var client = new DirectLineClient(directLineSecret);
// Start a new conversation
var conversation = await client.Conversations.StartConversationAsync();

Console.WriteLine($"CoPilot ConversationId: {conversation.ConversationId}");

static async Task GetInitialBotMessageAsync(DirectLineClient client, string conversationId)
{
string watermark = null;
// Poll for messages, assuming the bot sends a message at conversation start
while (true)
{
var response = await client.Conversations.GetActivitiesAsync(conversationId, watermark);
watermark = response.Watermark;
foreach (var activity in response.Activities)
{
if (activity.From.Id == "bot")
{
Console.WriteLine($"Bot (Initial Message): {activity.Text}");
return; // Exit after getting the initial message
}
}
await Task.Delay(1000); // Wait before polling again
}
}

// Ysend a message to the bot if needed
var userMessage = new Activity
{
From = new ChannelAccount("user1"),
Text = "Hello, how can I help?",
Type = ActivityTypes.Message
};
await client.Conversations.PostActivityAsync(conversationId, userMessage);

// We are getting a success response for the message what we sent
var response = await client.Conversations.GetActivitiesAsync(conversationId, watermark);
Copiolts.JPG
Categories:
I have the same question (0)
  • peterswimm Profile Picture
    Microsoft Employee on at
    Can you explain more about what you are doing? Are you creating a custom channel? Have you seen: https://learn.microsoft.com/en-us/microsoft-copilot-studio/publication-connect-bot-to-azure-bot-service-channels#sample-code-example
  • CU14081638-0 Profile Picture
    6 on at
    I would like to retrieve the default start conversation message from  that we created in Copilot Studio UI . We created a trigger 'On Conversation Start' on a topic with a message. How do I get this message using client.Conversations.GetActivitiesAsync .

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Copilot Studio

#1
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 130 Super User 2026 Season 1

#2
Valantis Profile Picture

Valantis 123

#3
chiaraalina Profile Picture

chiaraalina 33 Super User 2026 Season 1

Last 30 days Overall leaderboard