So I've been following this guide on how to send proactive messages, I've got that setup but it currently responds to the setup message. I would like it to create a whole new conversation, I've found some code that uses the CreateConversationAsync()
function but I've only managed to get it to work with it dm-ing the user rather than within the channel. See below for code example.
I know I'm doing something wrong but I can't tell what at this point.
const string botAppId = "<MicrosoftApptId GUID>";
const string serviceUrl = "<my service URL>";
const string tenantId = "<my tenant ID>";
const string recipientId = "<recipient ID xy:GUID>";
var title = "test title";
var activity = Activity.CreateMessageActivity();
activity.Type = ActivityTypes.Message;
activity.Text = "test message";
await ((BotAdapter)_adapter).CreateConversationAsync(
botAppId: botAppId,
channelId: Microsoft.Bot.Connector.Channels.Msteams,
serviceUrl: serviceUrl,
audience: null,
conversationParameters: new ConversationParameters
{
Activity = (Activity)activity,
Bot = new ChannelAccount(botAppId),
IsGroup = false,
Members = new List<ChannelAccount> { new ChannelAccount(recipientId) },
TopicName = title,
TenantId = tenantId
},
callback: BotCallback,
cancellationToken: default(CancellationToken));