Skip to main content

message_context type

This reference documents the Slack types at the platform level. Their availability and structure may differ in each SDK

Type: slack#/types/message_context

PropertyTypeDescription
defaultThe type that is being described.An optional parameter default value.
descriptionstringAn optional parameter description.
examplesAn array of the type being described.An optional list of examples.
hintstringAn optional parameter hint.
titlestringAn optional parameter title.
typestringString that defines the parameter type.

The message_context type is used in the ReplyInThread Slack function as the target message you want to reply to.

For example, let's say you have a workflow step that uses the SendMessage function. If you want to send a reply to that message in a follow-on step that calls the ReplyInThread function, pass the return value from the first step into the message_context parameter of ReplyInThread.

Here's a brief example:

// ...
"message_context": {
"type": "slack#/types/message_context"
}
// ...

You can also construct and deconstruct the message_context property as you see fit in your app. Here is what comprises message_context:

PropertyTypeDescriptionRequired
message_tsSchema.slack.types.message_tsA Slack-specific hash/timestamp necessary for referencing events like messages in Slack.Required
channel_idSchema.slack.types.channel_idThe ID of the channel where the message is posted.Optional

Any individual property on message_context could be referenced too. See the below example where we pass message_context.message_ts to the trigger_ts property:

//...

const message = CreateSurveyWorkflow.addStep(
Schema.slack.functions.ReplyInThread,
{
message_context: {
channel_id: CreateSurveyWorkflow.inputs.channel_id,
message_ts: CreateSurveyWorkflow.inputs.parent_ts,
},
message:
`Your feedback is requested – <${trigger.outputs.trigger_url}|survey now>!`,
},
);

CreateSurveyWorkflow.addStep(SaveSurveyFunctionDefinition, {
channel_id: CreateSurveyWorkflow.inputs.channel_id,
parent_ts: CreateSurveyWorkflow.inputs.parent_ts,
reactor_id: CreateSurveyWorkflow.inputs.reactor_id,
trigger_ts: message.outputs.message_context.message_ts, //Here we reference message_ts from message_context
trigger_id: trigger.outputs.trigger_id,
survey_stage: "SURVEY",
});

//...