Пример #1
0
        public static async Task MessageTeamTimer(
            [TimerTrigger("0 */1 * * * *")] TimerInfo myTimer,
            ILogger log)
        {
            var dialog = new DialogRoot();

            dialog.blocks = new Block[]
            { new Block
              {
                  type = "section",
                  text = new TextBlock
                  {
                      type = "mrkdwn",
                      text = "Good morning, slacker! It's standup time!!!"
                  },
                  accessory = new Accessory {
                      type = "button",
                      text = new TextBlock
                      {
                          type = "plain_text",
                          text = "Submit"
                      },
                      value = "submit"
                  }
              } };

            await SendSlackMessage(dialog, log);
        }
Пример #2
0
        public static async Task FromSlack(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            string  requestBody = req.Form["payload"]; //await new StreamReader(req.Body).ReadToEndAsync();
            dynamic data        = JsonConvert.DeserializeObject(requestBody);

            string message = $"Slack webhook triggered";

            log.LogInformation(requestBody);

            var dialog = new DialogRoot();

            dialog.blocks = new Block[]
            { new Block
              {
                  type = "section",
                  text = new TextBlock
                  {
                      type = "mrkdwn",
                      text = "It worked!!!"
                  },
                  accessory = new Accessory {
                      type = "button",
                      text = new TextBlock
                      {
                          type = "plain_text",
                          text = "Celebrate"
                      },
                      value = "submit"
                  }
              } };

            await SendSlackMessage(dialog, log);
        }