Skip to content

Commit b1bf16b

Browse files
authored
Merge pull request #215 from BlakeWilliams/acc-add-chat-schedule-msg
Adds support for scheduling messages in Slack Web API
2 parents c6b9824 + 2a8b06a commit b1bf16b

3 files changed

Lines changed: 129 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def application do
2424
end
2525

2626
def deps do
27-
[{:slack, "~> 0.21.0"}]
27+
[{:slack, "~> 0.21.1"}]
2828
end
2929
```
3030

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
{
2+
"desc": "Schedules a message to be sent to a channel.",
3+
4+
"args": {
5+
"token": {
6+
"required": true,
7+
"example": "xxxx-xxxxxxxxx-xxxx",
8+
"desc": "Authentication token bearing required scopes."
9+
},
10+
"channel": {
11+
"required": true,
12+
"example": "C1234567890",
13+
"desc": "Channel, private group, or DM channel to send message to. Can be an encoded ID, or a name."
14+
},
15+
"post_at": {
16+
"required": true,
17+
"example": "299876400",
18+
"desc": "Unix EPOCH timestamp of time in future to send the message."
19+
},
20+
"as_user": {
21+
"required": false,
22+
"example": "true",
23+
"desc": "Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See `chat.postMessage`."
24+
},
25+
"attachments": {
26+
"required": false,
27+
"example": "[{\"pretext\": \"pre-hello\", \"text\": \"text-world\"}]",
28+
"desc": "A JSON-based array of structured attachments, presented as a URL-encoded string."
29+
},
30+
"blocks": {
31+
"required": false,
32+
"example": "[{\"type\": \"section\", \"text\": {\"type\": \"plain_text\", \"text\": \"Hello world\"}}]",
33+
"desc": "A JSON-based array of structured blocks, presented as a URL-encoded string."
34+
},
35+
"link_names": {
36+
"required": false,
37+
"example": "true",
38+
"desc": "Find and link channel names and usernames."
39+
},
40+
"parse": {
41+
"required": false,
42+
"example": "full",
43+
"desc": "Change how messages are treated. Defaults to none. See `chat.postMessage`."
44+
},
45+
"reply_broadcast": {
46+
"required": false,
47+
"example": "true",
48+
"desc": "Used in conjunction with `thread_ts` and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to `false`."
49+
},
50+
"thread_ts": {
51+
"required": false,
52+
"example": "1234567890.123456",
53+
"desc": "Provide another message's `ts` value to make this message a reply. Avoid using a reply's `ts` value; use its parent instead."
54+
},
55+
"unfurl_links": {
56+
"required": false,
57+
"example": "true",
58+
"desc": "Pass true to enable unfurling of primarily text-based content."
59+
},
60+
"unfurl_media": {
61+
"required": false,
62+
"example": "false",
63+
"desc": "Pass false to disable unfurling of media content."
64+
}
65+
},
66+
67+
"response": {
68+
"ok": true,
69+
"channel": "C1H9RESGL",
70+
"scheduled_message_id": "Q1298393284",
71+
"post_at": "1562180400",
72+
"message": {
73+
"text": "Here's a message for you in the future",
74+
"username": "ecto1",
75+
"bot_id": "B19LU7CSY",
76+
"attachments": [
77+
{
78+
"text": "This is an attachment",
79+
"id": 1,
80+
"fallback": "This is an attachment's fallback"
81+
}
82+
],
83+
"type": "delayed_message",
84+
"subtype": "bot_message"
85+
}
86+
},
87+
88+
"errors": {
89+
"invalid_time" : "value passed for `post_time` was invalid.",
90+
"time_in_past" : "value passed for `post_time` was in the past.",
91+
"time_too_far": "value passed for `post_time` was too far into the future.",
92+
"channel_not_found": "Value passed for `channel` was invalid.",
93+
"not_in_channel": "Cannot post user messages to a channel they are not in.",
94+
"is_archived": "Channel has been archived.",
95+
"msg_too_long": "Message text is too long",
96+
"no_text": "No message text provided",
97+
"restricted_action": "A workspace preference prevents the authenticated user from posting.",
98+
"restricted_action_read_only_channel": "Cannot post any message into a read-only channel.",
99+
"restricted_action_thread_only_channel": "Cannot post top-level messages into a thread-only channel.",
100+
"restricted_action_non_threadable_channel": "Cannot post thread replies into a non_threadable channel.",
101+
"too_many_attachments": "Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.",
102+
"rate_limited": "Application has posted too many messages, read the Rate Limit documentation for more information",
103+
"not_authed": "No authentication token provided.",
104+
"invalid_auth": "Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.",
105+
"account_inactive": "Authentication token is for a deleted user or workspace.",
106+
"token_revoked": "Authentication token is for a deleted user or workspace or the app has been removed.",
107+
"no_permission": "The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.",
108+
"org_login_required": "The workspace is undergoing an enterprise migration and will not be available until migration is complete.",
109+
"ekm_access_denied": "Administrators have suspended the ability to post a message.",
110+
"missing_scope": "The token used is not granted the specific scope permissions required to complete this request.",
111+
"invalid_arguments": "The method was called with invalid arguments.",
112+
"invalid_arg_name": "The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.",
113+
"invalid_charset": "The method was called via a `POST` request, but the `charset` specified in the `Content-Type` header was invalid. Valid charset names are: `utf-8` `iso-8859-1`.",
114+
"invalid_form_data": "The method was called via a `POST` request with `Content-Type` `application/x-www-form-urlencoded` or `multipart/form-data`, but the form data was either missing or syntactically invalid.",
115+
"invalid_post_type": "The method was called via a `POST` request, but the specified `Content-Type` was invalid. Valid types are: `application/json` `application/x-www-form-urlencoded` `multipart/form-data` `text/plain`.",
116+
"missing_post_type": "The method was called via a `POST` request and included a data payload, but the request did not include a `Content-Type` header.",
117+
"team_added_to_org": "The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.",
118+
"request_timeout": "The method was called via a `POST` request, but the `POST` data was either missing or truncated.",
119+
"fatal_error": "The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised."
120+
},
121+
122+
"warnings": {
123+
"message_truncated": "The `text` field of a message should have no more than 40,000 characters. We truncate really long messages.",
124+
"missing_charset": "The method was called via a `POST` request, and recommended practice for the specified `Content-Type` is to include a `charset` parameter. However, no `charset` was present. Specifically, non-form-data content types (e.g. `text/plain`) are the ones for which `charset` is recommended.",
125+
"superfluous_charset": "The method was called via a `POST` request, and the specified `Content-Type` is not defined to understand the `charset` parameter. However, `charset` was in fact present. Specifically, form-data content types (e.g. `multipart/form-data`) are the ones for which `charset` is superfluous."
126+
}
127+
}

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule Slack.Mixfile do
44
def project do
55
[
66
app: :slack,
7-
version: "0.21.0",
7+
version: "0.21.1",
88
elixir: "~> 1.6",
99
elixirc_paths: elixirc_paths(Mix.env()),
1010
name: "Slack",

0 commit comments

Comments
 (0)