1. Packages
  2. Rootly
  3. API Docs
  4. WorkflowTaskSendSlackBlocks
Rootly v1.0.1 published on Friday, Jun 2, 2023 by Rootly

rootly.WorkflowTaskSendSlackBlocks

Explore with Pulumi AI

rootly logo
Rootly v1.0.1 published on Friday, Jun 2, 2023 by Rootly

    Manages workflow send_slack_blocks task.

    Example Usage

    using System.Collections.Generic;
    using System.Text.Json;
    using Pulumi;
    using Rootly = Pulumi.Rootly;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var sendMessageInIncidentChannel = new Rootly.WorkflowIncident("sendMessageInIncidentChannel", new Rootly.WorkflowIncidentArgs
            {
                Description = "Send a message in the incident channel",
                TriggerParams = new Rootly.Inputs.WorkflowIncidentTriggerParamsArgs
                {
                    Triggers = 
                    {
                        "incident_created",
                    },
                    IncidentStatuses = 
                    {
                        "started",
                    },
                    IncidentConditionStatus = "IS",
                },
                Enabled = true,
            });
            var sendSlackBlocks = new Rootly.WorkflowTaskSendSlackBlocks("sendSlackBlocks", new Rootly.WorkflowTaskSendSlackBlocksArgs
            {
                WorkflowId = sendMessageInIncidentChannel.Id,
                SkipOnFailure = false,
                Enabled = true,
                TaskParams = new Rootly.Inputs.WorkflowTaskSendSlackBlocksTaskParamsArgs
                {
                    Name = "Send Slack message",
                    Message = ":boom: New incident!",
                    Channels = 
                    {
                        new Rootly.Inputs.WorkflowTaskSendSlackBlocksTaskParamsChannelArgs
                        {
                            Name = "{{ incident.slack_channel_id }}",
                            Id = "{{ incident.slack_channel_id }}",
                        },
                    },
                    Blocks = JsonSerializer.Serialize(new[]
                        {
                            new Dictionary<string, object?>
                            {
                                { "text", new Dictionary<string, object?>
                                {
                                    { "emoji", true },
                                    { "text", "This is the incident title: {{ incident.title }}" },
                                    { "type", "plain_text" },
                                } },
                                { "type", "header" },
                            },
                        }
                    ),
                },
            });
        }
    
    }
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-rootly/sdk/go/rootly"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		sendMessageInIncidentChannel, err := rootly.NewWorkflowIncident(ctx, "sendMessageInIncidentChannel", &rootly.WorkflowIncidentArgs{
    			Description: pulumi.String("Send a message in the incident channel"),
    			TriggerParams: &WorkflowIncidentTriggerParamsArgs{
    				Triggers: pulumi.StringArray{
    					pulumi.String("incident_created"),
    				},
    				IncidentStatuses: pulumi.StringArray{
    					pulumi.String("started"),
    				},
    				IncidentConditionStatus: pulumi.String("IS"),
    			},
    			Enabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal([]map[string]interface{}{
    			map[string]interface{}{
    				"text": map[string]interface{}{
    					"emoji": true,
    					"text":  "This is the incident title: {{ incident.title }}",
    					"type":  "plain_text",
    				},
    				"type": "header",
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = rootly.NewWorkflowTaskSendSlackBlocks(ctx, "sendSlackBlocks", &rootly.WorkflowTaskSendSlackBlocksArgs{
    			WorkflowId:    sendMessageInIncidentChannel.ID(),
    			SkipOnFailure: pulumi.Bool(false),
    			Enabled:       pulumi.Bool(true),
    			TaskParams: &WorkflowTaskSendSlackBlocksTaskParamsArgs{
    				Name:    "Send Slack message",
    				Message: pulumi.String(":boom: New incident!"),
    				Channels: WorkflowTaskSendSlackBlocksTaskParamsChannelArray{
    					&WorkflowTaskSendSlackBlocksTaskParamsChannelArgs{
    						Name: pulumi.String("{{ incident.slack_channel_id }}"),
    						Id:   pulumi.String("{{ incident.slack_channel_id }}"),
    					},
    				},
    				Blocks: pulumi.String(json0),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Coming soon!

    import pulumi
    import json
    import pulumi_rootly as rootly
    
    send_message_in_incident_channel = rootly.WorkflowIncident("sendMessageInIncidentChannel",
        description="Send a message in the incident channel",
        trigger_params=rootly.WorkflowIncidentTriggerParamsArgs(
            triggers=["incident_created"],
            incident_statuses=["started"],
            incident_condition_status="IS",
        ),
        enabled=True)
    send_slack_blocks = rootly.WorkflowTaskSendSlackBlocks("sendSlackBlocks",
        workflow_id=send_message_in_incident_channel.id,
        skip_on_failure=False,
        enabled=True,
        task_params=rootly.WorkflowTaskSendSlackBlocksTaskParamsArgs(
            name="Send Slack message",
            message=":boom: New incident!",
            channels=[rootly.WorkflowTaskSendSlackBlocksTaskParamsChannelArgs(
                name="{{ incident.slack_channel_id }}",
                id="{{ incident.slack_channel_id }}",
            )],
            blocks=json.dumps([{
                "text": {
                    "emoji": True,
                    "text": "This is the incident title: {{ incident.title }}",
                    "type": "plain_text",
                },
                "type": "header",
            }]),
        ))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as rootly from "@pulumi/rootly";
    
    const sendMessageInIncidentChannel = new rootly.WorkflowIncident("sendMessageInIncidentChannel", {
        description: "Send a message in the incident channel",
        triggerParams: {
            triggers: ["incident_created"],
            incidentStatuses: ["started"],
            incidentConditionStatus: "IS",
        },
        enabled: true,
    });
    const sendSlackBlocks = new rootly.WorkflowTaskSendSlackBlocks("sendSlackBlocks", {
        workflowId: sendMessageInIncidentChannel.id,
        skipOnFailure: false,
        enabled: true,
        taskParams: {
            name: "Send Slack message",
            message: ":boom: New incident!",
            channels: [{
                name: "{{ incident.slack_channel_id }}",
                id: "{{ incident.slack_channel_id }}",
            }],
            blocks: JSON.stringify([{
                text: {
                    emoji: true,
                    text: "This is the incident title: {{ incident.title }}",
                    type: "plain_text",
                },
                type: "header",
            }]),
        },
    });
    

    Coming soon!

    Create WorkflowTaskSendSlackBlocks Resource

    new WorkflowTaskSendSlackBlocks(name: string, args: WorkflowTaskSendSlackBlocksArgs, opts?: CustomResourceOptions);
    @overload
    def WorkflowTaskSendSlackBlocks(resource_name: str,
                                    opts: Optional[ResourceOptions] = None,
                                    enabled: Optional[bool] = None,
                                    position: Optional[int] = None,
                                    skip_on_failure: Optional[bool] = None,
                                    task_params: Optional[WorkflowTaskSendSlackBlocksTaskParamsArgs] = None,
                                    workflow_id: Optional[str] = None)
    @overload
    def WorkflowTaskSendSlackBlocks(resource_name: str,
                                    args: WorkflowTaskSendSlackBlocksArgs,
                                    opts: Optional[ResourceOptions] = None)
    func NewWorkflowTaskSendSlackBlocks(ctx *Context, name string, args WorkflowTaskSendSlackBlocksArgs, opts ...ResourceOption) (*WorkflowTaskSendSlackBlocks, error)
    public WorkflowTaskSendSlackBlocks(string name, WorkflowTaskSendSlackBlocksArgs args, CustomResourceOptions? opts = null)
    public WorkflowTaskSendSlackBlocks(String name, WorkflowTaskSendSlackBlocksArgs args)
    public WorkflowTaskSendSlackBlocks(String name, WorkflowTaskSendSlackBlocksArgs args, CustomResourceOptions options)
    
    type: rootly:WorkflowTaskSendSlackBlocks
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args WorkflowTaskSendSlackBlocksArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args WorkflowTaskSendSlackBlocksArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args WorkflowTaskSendSlackBlocksArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args WorkflowTaskSendSlackBlocksArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args WorkflowTaskSendSlackBlocksArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    WorkflowTaskSendSlackBlocks Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The WorkflowTaskSendSlackBlocks resource accepts the following input properties:

    TaskParams WorkflowTaskSendSlackBlocksTaskParams

    The parameters for this workflow task.

    WorkflowId string

    The ID of the parent workflow

    Enabled bool

    Enable/disable this workflow task

    Position int

    The position of the workflow task (1 being top of list)

    SkipOnFailure bool

    Skip workflow task if any failures

    TaskParams WorkflowTaskSendSlackBlocksTaskParamsArgs

    The parameters for this workflow task.

    WorkflowId string

    The ID of the parent workflow

    Enabled bool

    Enable/disable this workflow task

    Position int

    The position of the workflow task (1 being top of list)

    SkipOnFailure bool

    Skip workflow task if any failures

    taskParams WorkflowTaskSendSlackBlocksTaskParams

    The parameters for this workflow task.

    workflowId String

    The ID of the parent workflow

    enabled Boolean

    Enable/disable this workflow task

    position Integer

    The position of the workflow task (1 being top of list)

    skipOnFailure Boolean

    Skip workflow task if any failures

    taskParams WorkflowTaskSendSlackBlocksTaskParams

    The parameters for this workflow task.

    workflowId string

    The ID of the parent workflow

    enabled boolean

    Enable/disable this workflow task

    position number

    The position of the workflow task (1 being top of list)

    skipOnFailure boolean

    Skip workflow task if any failures

    task_params WorkflowTaskSendSlackBlocksTaskParamsArgs

    The parameters for this workflow task.

    workflow_id str

    The ID of the parent workflow

    enabled bool

    Enable/disable this workflow task

    position int

    The position of the workflow task (1 being top of list)

    skip_on_failure bool

    Skip workflow task if any failures

    taskParams Property Map

    The parameters for this workflow task.

    workflowId String

    The ID of the parent workflow

    enabled Boolean

    Enable/disable this workflow task

    position Number

    The position of the workflow task (1 being top of list)

    skipOnFailure Boolean

    Skip workflow task if any failures

    Outputs

    All input properties are implicitly available as output properties. Additionally, the WorkflowTaskSendSlackBlocks resource produces the following output properties:

    Id string

    The provider-assigned unique ID for this managed resource.

    Id string

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    id string

    The provider-assigned unique ID for this managed resource.

    id str

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    Look up Existing WorkflowTaskSendSlackBlocks Resource

    Get an existing WorkflowTaskSendSlackBlocks resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: WorkflowTaskSendSlackBlocksState, opts?: CustomResourceOptions): WorkflowTaskSendSlackBlocks
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            enabled: Optional[bool] = None,
            position: Optional[int] = None,
            skip_on_failure: Optional[bool] = None,
            task_params: Optional[WorkflowTaskSendSlackBlocksTaskParamsArgs] = None,
            workflow_id: Optional[str] = None) -> WorkflowTaskSendSlackBlocks
    func GetWorkflowTaskSendSlackBlocks(ctx *Context, name string, id IDInput, state *WorkflowTaskSendSlackBlocksState, opts ...ResourceOption) (*WorkflowTaskSendSlackBlocks, error)
    public static WorkflowTaskSendSlackBlocks Get(string name, Input<string> id, WorkflowTaskSendSlackBlocksState? state, CustomResourceOptions? opts = null)
    public static WorkflowTaskSendSlackBlocks get(String name, Output<String> id, WorkflowTaskSendSlackBlocksState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Enabled bool

    Enable/disable this workflow task

    Position int

    The position of the workflow task (1 being top of list)

    SkipOnFailure bool

    Skip workflow task if any failures

    TaskParams WorkflowTaskSendSlackBlocksTaskParams

    The parameters for this workflow task.

    WorkflowId string

    The ID of the parent workflow

    Enabled bool

    Enable/disable this workflow task

    Position int

    The position of the workflow task (1 being top of list)

    SkipOnFailure bool

    Skip workflow task if any failures

    TaskParams WorkflowTaskSendSlackBlocksTaskParamsArgs

    The parameters for this workflow task.

    WorkflowId string

    The ID of the parent workflow

    enabled Boolean

    Enable/disable this workflow task

    position Integer

    The position of the workflow task (1 being top of list)

    skipOnFailure Boolean

    Skip workflow task if any failures

    taskParams WorkflowTaskSendSlackBlocksTaskParams

    The parameters for this workflow task.

    workflowId String

    The ID of the parent workflow

    enabled boolean

    Enable/disable this workflow task

    position number

    The position of the workflow task (1 being top of list)

    skipOnFailure boolean

    Skip workflow task if any failures

    taskParams WorkflowTaskSendSlackBlocksTaskParams

    The parameters for this workflow task.

    workflowId string

    The ID of the parent workflow

    enabled bool

    Enable/disable this workflow task

    position int

    The position of the workflow task (1 being top of list)

    skip_on_failure bool

    Skip workflow task if any failures

    task_params WorkflowTaskSendSlackBlocksTaskParamsArgs

    The parameters for this workflow task.

    workflow_id str

    The ID of the parent workflow

    enabled Boolean

    Enable/disable this workflow task

    position Number

    The position of the workflow task (1 being top of list)

    skipOnFailure Boolean

    Skip workflow task if any failures

    taskParams Property Map

    The parameters for this workflow task.

    workflowId String

    The ID of the parent workflow

    Supporting Types

    WorkflowTaskSendSlackBlocksTaskParams, WorkflowTaskSendSlackBlocksTaskParamsArgs

    WorkflowTaskSendSlackBlocksTaskParamsChannel, WorkflowTaskSendSlackBlocksTaskParamsChannelArgs

    Id string
    Name string
    Id string
    Name string
    id String
    name String
    id string
    name string
    id str
    name str
    id String
    name String

    WorkflowTaskSendSlackBlocksTaskParamsSlackUser, WorkflowTaskSendSlackBlocksTaskParamsSlackUserArgs

    Id string
    Name string
    Id string
    Name string
    id String
    name String
    id string
    name string
    id str
    name str
    id String
    name String

    WorkflowTaskSendSlackBlocksTaskParamsSlackUserGroup, WorkflowTaskSendSlackBlocksTaskParamsSlackUserGroupArgs

    Id string
    Name string
    Id string
    Name string
    id String
    name String
    id string
    name string
    id str
    name str
    id String
    name String

    Package Details

    Repository
    rootly rootlyhq/pulumi-rootly
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the rootly Terraform Provider.

    rootly logo
    Rootly v1.0.1 published on Friday, Jun 2, 2023 by Rootly