chatPostEphemeral
Sends an ephemeral message to a user in a channel.
Details
- Method:
POST - Path:
/chat.postEphemeral - Operation ID:
chat_postEphemeral
Parameters
{
"token": {
"description": "Authentication token. Requires scope: `chat:write`",
"required": true,
"location": "header",
"type": "string"
},
"as_user": {
"description": "Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false.",
"required": false,
"location": "formData",
"type": "string"
},
"attachments": {
"description": "A JSON-based array of structured attachments, presented as a URL-encoded string.",
"required": false,
"location": "formData",
"type": "string"
},
"blocks": {
"description": "A JSON-based array of structured blocks, presented as a URL-encoded string.",
"required": false,
"location": "formData",
"type": "string"
},
"channel": {
"description": "Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.",
"required": true,
"location": "formData",
"type": "string"
},
"icon_emoji": {
"description": "Emoji to use as the icon for this message. Overrides `icon_url`. Must be used in conjunction with `as_user` set to `false`, otherwise ignored. See [authorship](#authorship) below.",
"required": false,
"location": "formData",
"type": "string"
},
"icon_url": {
"description": "URL to an image to use as the icon for this message. Must be used in conjunction with `as_user` set to false, otherwise ignored. See [authorship](#authorship) below.",
"required": false,
"location": "formData",
"type": "string"
},
"link_names": {
"description": "Find and link channel names and usernames.",
"required": false,
"location": "formData",
"type": "string"
},
"parse": {
"description": "Change how messages are treated. Defaults to `none`. See [below](#formatting).",
"required": false,
"location": "formData",
"type": "string"
},
"text": {
"description": "How this field works and whether it is required depends on other fields you use in your API call. [See below](#text_usage) for more detail.",
"required": false,
"location": "formData",
"type": "string"
},
"thread_ts": {
"description": "Provide another message's `ts` value to post this message in a thread. Avoid using a reply's `ts` value; use its parent's value instead. Ephemeral messages in threads are only shown if there is already an active thread.",
"required": false,
"location": "formData",
"type": "string"
},
"user": {
"description": "`id` of the user who will receive the ephemeral message. The user should be in the channel specified by the `channel` argument.",
"required": true,
"location": "formData",
"type": "string"
},
"username": {
"description": "Set your bot's user name. Must be used in conjunction with `as_user` set to false, otherwise ignored. See [authorship](#authorship) below.",
"required": false,
"location": "formData",
"type": "string"
}
}Response Schema
{
"additionalProperties": false,
"description": "Schema for successful response from chat.postEphemeral method",
"properties": {
"message_ts": {
"pattern": "^\\d{10}\\.\\d{6}$",
"title": "Timestamp in format 0123456789.012345",
"type": "string"
},
"ok": {
"enum": [
true
],
"title": "default success response",
"type": "boolean"
}
},
"required": [
"ok",
"message_ts"
],
"title": "chat.postEphemeral success schema",
"type": "object"
}Usage
from ocp_agent import OCPAgent
agent = OCPAgent()
await agent.register_api('slack')
# Call this tool
result = await agent.call_tool('chatPostEphemeral', {
# Add required parameters here
})