private static ActivityType CreateWebhookActivityType(WebhookAttribute webhookAttribute)
        {
            var typeName    = webhookAttribute.ActivityType;
            var displayName = webhookAttribute.DisplayName;
            var description = webhookAttribute.Description;

            return(new ActivityType
            {
                Describe = () => new ActivityDescriptor
                {
                    Category = "Telnyx",
                    Description = description,
                    Type = typeName,
                    Outcomes = new[] { OutcomeNames.Done },
                    Traits = ActivityTraits.Trigger,
                    DisplayName = displayName
                },
                Description = description,
                DisplayName = displayName,
                TypeName = typeName,
                Attributes = new Dictionary <string, object>
                {
                    [NotificationAttribute] = true,
                    [EventTypeAttribute] = webhookAttribute.EventType
                },
                CanExecuteAsync = _ => new ValueTask <bool>(true),
                ExecuteAsync = context => context.WorkflowExecutionContext.IsFirstPass ? ExecuteInternal(context) : new ValueTask <IActivityExecutionResult>(new SuspendResult()),
                ResumeAsync = ExecuteInternal,
            });
        }
        private async Task <ActivityType> CreateWebhookActivityTypeAsync(Type payloadType, WebhookAttribute webhookAttribute, CancellationToken cancellationToken)
        {
            var descriptor = await _describesActivityType.DescribeAsync <Webhook>(cancellationToken);

            descriptor.Description = webhookAttribute.Description;
            descriptor.DisplayName = webhookAttribute.DisplayName;
            descriptor.Type        = webhookAttribute.ActivityType;

            var outputProperties = descriptor.OutputProperties.Where(x => x.Name != nameof(Webhook.Output)).ToList();

            outputProperties.Add(new ActivityOutputDescriptor(nameof(Webhook.Output), payloadType));
            descriptor.OutputProperties = outputProperties.ToArray();

            return(new ActivityType
            {
                Describe = () => descriptor,
                Description = descriptor.Description,
                DisplayName = descriptor.DisplayName,
                TypeName = descriptor.Type,
                Attributes = new Dictionary <string, object>
                {
                    [NotificationAttribute] = true,
                    [EventTypeAttribute] = webhookAttribute.EventType
                },
                ActivateAsync = async context => await _activityActivator.ActivateActivityAsync <Webhook>(context, cancellationToken),
                CanExecuteAsync = (context, instance) => instance.CanExecuteAsync(context),
                ExecuteAsync = (context, instance) => instance.ExecuteAsync(context),
                ResumeAsync = (context, instance) => instance.ResumeAsync(context),
            });
        }