I understand how to do this in code outside of composer, but is there a way to be able to use this within composer?
There's this: How to get message id of sent message Bot Framework (Teams channel)? but it's not from composer.
It'd have to be in a custom action (as you mention) and then returning resource Id in the result property, so you can use it elsewhere. The BeginDialogAsync
method of the custom action would something like this:
public override async Task<DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken))
{
var activity = Activity.CreateMessageActivity();
//...
var resource = await dc.Context.SendActivityAsync(activity);
if (this.ResultProperty != null)
{
dc.State.SetValue(this.ResultProperty.GetValue(dc.State), result);
}
return await dc.EndDialogAsync(result: result, cancellationToken: cancellationToken);
}
UPDATE
Updated the code use the "ResultProperty" property, just as the sample custom action in the custom runtime. This way the custom action would be much more reusable.