Language

SlackResponse Class

Definition

Represents a response from the Slack Web API.

public class SlackResponse : Microsoft.Agents.Extensions.Slack.Api.SlackModel
type SlackResponse = class
    inherit SlackModel
Public Class SlackResponse
Inherits SlackModel
Inheritance
SlackResponse

Remarks

Named properties cover the fields common to every Slack API response. Any additional fields returned by a specific method are accessible via the AdditionalProperties dictionary or via dot-notation path using Get<T>(String) and TryGet<T>(String, T).

SlackResponse r = await slackApi.CallAsync("chat.postMessage", options, token);
string channel = r.Get<string>("channel");
string msgTs   = r.Get<string>("message.ts");

Constructors

Name Description
SlackResponse()

Properties

Name Description
AdditionalProperties

Catch-all for any response fields not explicitly modelled above.

error

Error code returned by Slack when ok is false.

ok

Whether the API call succeeded.

response_metadata

Gets or sets the metadata associated with the response.

ts

Message timestamp, present on methods that create or update messages.

warning

Warning code returned alongside a successful response.

Methods

Name Description
Get<T>(String)

Gets a value at the given dot-notation path. Supports dot-separated property access and bracket array indexing (e.g. "message.attachments[0].text"). Returns default when the path does not exist or the value cannot be converted to T.

(Inherited from SlackModel)
GetData()

Returns the JsonObject used for path navigation. The default implementation lazily serializes this instance via JsonSerializer.SerializeToNode, making every property and [JsonExtensionData] field addressable. Override when the subclass is already backed by a JsonObject to return it directly.

(Inherited from SlackModel)
NormalizePath(String)

Normalizes a caller-supplied path before it is passed to the navigator. Override to remap C# property-name aliases to their JSON field names. The default implementation returns the path unchanged.

(Inherited from SlackModel)
TryGet<T>(String, T)

Tries to get a value at the given dot-notation path. Returns false when the path does not exist or the value cannot be converted to T.

(Inherited from SlackModel)

Applies to