Defines the configuration options for the Slack binding.
        public SlackBinding(ParameterInfo parameter, SlackAttribute attribute, SlackConfiguration config, INameResolver nameResolver, BindingProviderContext context)
        {
            _parameter = parameter;
            _attribute = attribute;
            _config = config;
            _nameResolver = nameResolver;
            
            if(!string.IsNullOrEmpty(_attribute.WebHookUrl))
            {
                _webHookUrlBindingTemplate = CreateBindingTemplate(_attribute.WebHookUrl, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.Text))
            {
                _textBindingTemplate = CreateBindingTemplate(_attribute.Text, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.Username))
            {
                _usernameBindingTemplate = CreateBindingTemplate(_attribute.Username, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.IconEmoji))
            {
                _iconEmojiBindingTemplate = CreateBindingTemplate(_attribute.IconEmoji, context.BindingDataContract);
            }

            if (!string.IsNullOrEmpty(_attribute.Channel))
            {
                _channelBindingTemplate = CreateBindingTemplate(_attribute.Channel, context.BindingDataContract);
            }
        }
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            var config = new JobHostConfiguration();
            var slackConfig = new SlackConfiguration();
            WebHooksConfiguration webhookConfig;

            if(config.IsDevelopment)
            {
                config.UseDevelopmentSettings();
                webhookConfig = new WebHooksConfiguration(3000);
            }
            else
            {
                webhookConfig = new WebHooksConfiguration();
            }

            // These are optional and will be applied if no other value is specified.
            /*
            slackConfig.WebHookUrl = "";
            // IT IS A BAD THING TO HARDCODE YOUR WEBHOOKURL, USE THE APP SETTING "AzureWebJobsSlackWebHookKeyName"
            slackConfig.IconEmoji = "";
            slackConfig.Username = "";
            slackConfig.Channel = "";
            */

            config.UseSlack(slackConfig);
            config.UseWebHooks(webhookConfig);

            var host = new JobHost(config);
            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
        /// <summary>
        /// Enables use of the Slack extensions
        /// </summary>
        /// <param name="config">The <see cref="JobHostConfiguration"/> to configure.</param>
        /// <param name="slackConfig">The <see cref="SlackConfiguration"/> to use.</param>
        public static void UseSlack(this JobHostConfiguration config, SlackConfiguration slackConfig = null)
        {
            if (config == null) {
                throw new ArgumentNullException("config");
            }

            if(slackConfig == null)
            {
                slackConfig = new SlackConfiguration();
            }

            config.RegisterExtensionConfigProvider(new SlackExtensionConfig(slackConfig));
        }
        /// <summary>
        /// Enables use of the Slack extensions
        /// </summary>
        /// <param name="config">The <see cref="JobHostConfiguration"/> to configure.</param>
        /// <param name="slackConfig">The <see cref="SlackConfiguration"/> to use.</param>
        public static void UseSlack(this JobHostConfiguration config, SlackConfiguration slackConfig = null)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (slackConfig == null)
            {
                slackConfig = new SlackConfiguration();
            }

            config.RegisterExtensionConfigProvider(new SlackExtensionConfig(slackConfig));
        }
 public SlackExtensionConfig(SlackConfiguration slackConfig)
 {
     _slackConfig = slackConfig;
 }
 public SlackExtensionConfig(SlackConfiguration slackConfig)
 {
     _slackConfig = slackConfig;
 }