slack-ruby-client 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -8
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/bin/commands.rb +1 -0
- data/bin/commands/api.rb +2 -2
- data/bin/commands/apps_permissions.rb +22 -0
- data/bin/commands/auth.rb +4 -4
- data/bin/commands/bots.rb +2 -2
- data/bin/commands/channels.rb +31 -31
- data/bin/commands/chat.rb +40 -23
- data/bin/commands/dnd.rb +8 -8
- data/bin/commands/emoji.rb +2 -2
- data/bin/commands/files.rb +17 -17
- data/bin/commands/files_comments.rb +6 -6
- data/bin/commands/groups.rb +36 -35
- data/bin/commands/im.rb +13 -13
- data/bin/commands/mpim.rb +11 -11
- data/bin/commands/oauth.rb +15 -2
- data/bin/commands/pins.rb +6 -6
- data/bin/commands/reactions.rb +13 -13
- data/bin/commands/reminders.rb +10 -10
- data/bin/commands/rtm.rb +10 -6
- data/bin/commands/search.rb +9 -9
- data/bin/commands/stars.rb +8 -8
- data/bin/commands/team.rb +10 -10
- data/bin/commands/team_profile.rb +2 -2
- data/bin/commands/usergroups.rb +16 -16
- data/bin/commands/usergroups_users.rb +4 -4
- data/bin/commands/users.rb +20 -18
- data/bin/commands/users_profile.rb +7 -7
- data/lib/slack/real_time/stores/starter.rb +20 -0
- data/lib/slack/real_time/stores/store.rb +20 -0
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +2 -0
- data/lib/slack/web/api/endpoints/api.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_permissions.rb +35 -0
- data/lib/slack/web/api/endpoints/auth.rb +2 -2
- data/lib/slack/web/api/endpoints/bots.rb +1 -1
- data/lib/slack/web/api/endpoints/channels.rb +17 -18
- data/lib/slack/web/api/endpoints/chat.rb +67 -30
- data/lib/slack/web/api/endpoints/dnd.rb +4 -4
- data/lib/slack/web/api/endpoints/emoji.rb +1 -1
- data/lib/slack/web/api/endpoints/files.rb +16 -17
- data/lib/slack/web/api/endpoints/files_comments.rb +8 -8
- data/lib/slack/web/api/endpoints/groups.rb +21 -22
- data/lib/slack/web/api/endpoints/im.rb +8 -10
- data/lib/slack/web/api/endpoints/mpim.rb +7 -9
- data/lib/slack/web/api/endpoints/oauth.rb +23 -2
- data/lib/slack/web/api/endpoints/pins.rb +3 -5
- data/lib/slack/web/api/endpoints/reactions.rb +14 -16
- data/lib/slack/web/api/endpoints/reminders.rb +5 -5
- data/lib/slack/web/api/endpoints/rtm.rb +14 -6
- data/lib/slack/web/api/endpoints/search.rb +9 -9
- data/lib/slack/web/api/endpoints/stars.rb +7 -9
- data/lib/slack/web/api/endpoints/team.rb +8 -9
- data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
- data/lib/slack/web/api/endpoints/usergroups.rb +17 -17
- data/lib/slack/web/api/endpoints/usergroups_users.rb +2 -2
- data/lib/slack/web/api/endpoints/users.rb +15 -15
- data/lib/slack/web/api/endpoints/users_profile.rb +8 -8
- data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +4 -3
- data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +17 -0
- data/spec/integration/integration_spec.rb +1 -1
- data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +15 -0
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +37 -1
- data/spec/slack/web/api/endpoints/files_comments_spec.rb +8 -8
- data/spec/slack/web/api/endpoints/files_spec.rb +0 -5
- data/spec/slack/web/api/endpoints/oauth_spec.rb +11 -0
- metadata +7 -2
@@ -2,22 +2,22 @@
|
|
2
2
|
|
3
3
|
desc 'UsersProfile methods.'
|
4
4
|
command 'users_profile' do |g|
|
5
|
-
g.desc "
|
6
|
-
g.long_desc %(
|
5
|
+
g.desc "Retrieves a user's profile information."
|
6
|
+
g.long_desc %( Retrieves a user's profile information. )
|
7
7
|
g.command 'get' do |c|
|
8
|
-
c.flag 'user', desc: 'User to retrieve profile info for.'
|
9
8
|
c.flag 'include_labels', desc: 'Include labels for each ID in custom profile fields.'
|
9
|
+
c.flag 'user', desc: 'User to retrieve profile info for.'
|
10
10
|
c.action do |_global_options, options, _args|
|
11
11
|
puts JSON.dump($client.users_profile_get(options))
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
g.desc
|
16
|
-
g.long_desc %(
|
15
|
+
g.desc 'Set the profile information for a user.'
|
16
|
+
g.long_desc %( Set the profile information for a user. )
|
17
17
|
g.command 'set' do |c|
|
18
|
-
c.flag 'user', desc: 'ID of user to change. This argument may only be specified by team admins on paid teams.'
|
19
|
-
c.flag 'profile', desc: 'Collection of key:value pairs presented as a URL-encoded JSON hash.'
|
20
18
|
c.flag 'name', desc: 'Name of a single key to set. Usable only if profile is not passed.'
|
19
|
+
c.flag 'profile', desc: 'Collection of key:value pairs presented as a URL-encoded JSON hash.'
|
20
|
+
c.flag 'user', desc: 'ID of user to change. This argument may only be specified by team admins on paid teams.'
|
21
21
|
c.flag 'value', desc: 'Value to set a single key to. Usable only if profile is not passed.'
|
22
22
|
c.action do |_global_options, options, _args|
|
23
23
|
puts JSON.dump($client.users_profile_set(options))
|
@@ -14,6 +14,26 @@ module Slack
|
|
14
14
|
|
15
15
|
### RealTime Events
|
16
16
|
|
17
|
+
# The membership of an existing User Group has changed.
|
18
|
+
# @see https://api.slack.com/events/subteam_members_changed
|
19
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_members_changed.json
|
20
|
+
# on :subteam_members_changed do |data|
|
21
|
+
|
22
|
+
# Subscribe to presence events for the specified users.
|
23
|
+
# @see https://api.slack.com/events/presence_sub
|
24
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/events/presence_sub.json
|
25
|
+
# on :presence_sub do |data|
|
26
|
+
|
27
|
+
# A user left a public or private channel.
|
28
|
+
# @see https://api.slack.com/events/member_left_channel
|
29
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/events/member_left_channel.json
|
30
|
+
# on :member_left_channel do |data|
|
31
|
+
|
32
|
+
# A user joined a public or private channel.
|
33
|
+
# @see https://api.slack.com/events/member_joined_channel
|
34
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/events/member_joined_channel.json
|
35
|
+
# on :member_joined_channel do |data|
|
36
|
+
|
17
37
|
# The server intends to close the connection soon..
|
18
38
|
# @see https://api.slack.com/events/goodbye
|
19
39
|
# @see https://github.com/dblock/slack-api-ref/blob/master/events/goodbye.json
|
@@ -54,6 +54,26 @@ module Slack
|
|
54
54
|
|
55
55
|
### RealTime Events
|
56
56
|
|
57
|
+
# The membership of an existing User Group has changed.
|
58
|
+
# @see https://api.slack.com/events/subteam_members_changed
|
59
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_members_changed.json
|
60
|
+
# on :subteam_members_changed do |data|
|
61
|
+
|
62
|
+
# Subscribe to presence events for the specified users.
|
63
|
+
# @see https://api.slack.com/events/presence_sub
|
64
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/events/presence_sub.json
|
65
|
+
# on :presence_sub do |data|
|
66
|
+
|
67
|
+
# A user left a public or private channel.
|
68
|
+
# @see https://api.slack.com/events/member_left_channel
|
69
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/events/member_left_channel.json
|
70
|
+
# on :member_left_channel do |data|
|
71
|
+
|
72
|
+
# A user joined a public or private channel.
|
73
|
+
# @see https://api.slack.com/events/member_joined_channel
|
74
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/events/member_joined_channel.json
|
75
|
+
# on :member_joined_channel do |data|
|
76
|
+
|
57
77
|
# The server intends to close the connection soon..
|
58
78
|
# @see https://api.slack.com/events/goodbye
|
59
79
|
# @see https://github.com/dblock/slack-api-ref/blob/master/events/goodbye.json
|
data/lib/slack/version.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# This file was auto-generated by lib/tasks/web.rake
|
2
2
|
|
3
3
|
require_relative 'endpoints/api'
|
4
|
+
require_relative 'endpoints/apps_permissions'
|
4
5
|
require_relative 'endpoints/auth'
|
5
6
|
require_relative 'endpoints/bots'
|
6
7
|
require_relative 'endpoints/channels'
|
@@ -35,6 +36,7 @@ module Slack
|
|
35
36
|
include Slack::Web::Api::Mixins::Groups
|
36
37
|
|
37
38
|
include Api
|
39
|
+
include AppsPermissions
|
38
40
|
include Auth
|
39
41
|
include Bots
|
40
42
|
include Channels
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Web
|
5
|
+
module Api
|
6
|
+
module Endpoints
|
7
|
+
module AppsPermissions
|
8
|
+
#
|
9
|
+
# Returns list of permissions this app has on a team.
|
10
|
+
#
|
11
|
+
# @see https://api.slack.com/methods/apps.permissions.info
|
12
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/apps.permissions/apps.permissions.info.json
|
13
|
+
def apps_permissions_info(options = {})
|
14
|
+
post('apps.permissions.info', options)
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# Allows an app to request additional scopes
|
19
|
+
#
|
20
|
+
# @option options [Object] :scopes
|
21
|
+
# A comma separated list of scopes to request for.
|
22
|
+
# @option options [Object] :trigger_id
|
23
|
+
# Token used to trigger the permissions API.
|
24
|
+
# @see https://api.slack.com/methods/apps.permissions.request
|
25
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/apps.permissions/apps.permissions.request.json
|
26
|
+
def apps_permissions_request(options = {})
|
27
|
+
throw ArgumentError.new('Required arguments :scopes missing') if options[:scopes].nil?
|
28
|
+
throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
|
29
|
+
post('apps.permissions.request', options)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -6,7 +6,7 @@ module Slack
|
|
6
6
|
module Endpoints
|
7
7
|
module Auth
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# Revokes a token.
|
10
10
|
#
|
11
11
|
# @option options [Object] :test
|
12
12
|
# Setting this parameter to 1 triggers a testing mode where the specified token will not actually be revoked.
|
@@ -17,7 +17,7 @@ module Slack
|
|
17
17
|
end
|
18
18
|
|
19
19
|
#
|
20
|
-
#
|
20
|
+
# Checks authentication & identity.
|
21
21
|
#
|
22
22
|
# @see https://api.slack.com/methods/auth.test
|
23
23
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/auth/auth.test.json
|
@@ -6,7 +6,7 @@ module Slack
|
|
6
6
|
module Endpoints
|
7
7
|
module Channels
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# Archives a channel.
|
10
10
|
#
|
11
11
|
# @option options [channel] :channel
|
12
12
|
# Channel to archive.
|
@@ -19,7 +19,7 @@ module Slack
|
|
19
19
|
end
|
20
20
|
|
21
21
|
#
|
22
|
-
#
|
22
|
+
# Creates a channel.
|
23
23
|
#
|
24
24
|
# @option options [Object] :name
|
25
25
|
# Name of channel to create.
|
@@ -33,16 +33,16 @@ module Slack
|
|
33
33
|
end
|
34
34
|
|
35
35
|
#
|
36
|
-
#
|
36
|
+
# Fetches history of messages and events from a channel.
|
37
37
|
#
|
38
38
|
# @option options [channel] :channel
|
39
39
|
# Channel to fetch history for.
|
40
|
+
# @option options [Object] :inclusive
|
41
|
+
# Include messages with latest or oldest timestamp in results.
|
40
42
|
# @option options [timestamp] :latest
|
41
43
|
# End of time range of messages to include in results.
|
42
44
|
# @option options [timestamp] :oldest
|
43
45
|
# Start of time range of messages to include in results.
|
44
|
-
# @option options [Object] :inclusive
|
45
|
-
# Include messages with latest or oldest timestamp in results.
|
46
46
|
# @option options [Object] :unreads
|
47
47
|
# Include unread_count_display in the output?.
|
48
48
|
# @see https://api.slack.com/methods/channels.history
|
@@ -54,7 +54,7 @@ module Slack
|
|
54
54
|
end
|
55
55
|
|
56
56
|
#
|
57
|
-
#
|
57
|
+
# Gets information about a channel.
|
58
58
|
#
|
59
59
|
# @option options [channel] :channel
|
60
60
|
# Channel to get info on.
|
@@ -67,7 +67,7 @@ module Slack
|
|
67
67
|
end
|
68
68
|
|
69
69
|
#
|
70
|
-
#
|
70
|
+
# Invites a user to a channel.
|
71
71
|
#
|
72
72
|
# @option options [channel] :channel
|
73
73
|
# Channel to invite user to.
|
@@ -84,8 +84,7 @@ module Slack
|
|
84
84
|
end
|
85
85
|
|
86
86
|
#
|
87
|
-
#
|
88
|
-
# created.
|
87
|
+
# Joins a channel, creating it if needed.
|
89
88
|
#
|
90
89
|
# @option options [Object] :name
|
91
90
|
# Name of channel to join.
|
@@ -99,7 +98,7 @@ module Slack
|
|
99
98
|
end
|
100
99
|
|
101
100
|
#
|
102
|
-
#
|
101
|
+
# Removes a user from a channel.
|
103
102
|
#
|
104
103
|
# @option options [channel] :channel
|
105
104
|
# Channel to remove user from.
|
@@ -116,7 +115,7 @@ module Slack
|
|
116
115
|
end
|
117
116
|
|
118
117
|
#
|
119
|
-
#
|
118
|
+
# Leaves a channel.
|
120
119
|
#
|
121
120
|
# @option options [channel] :channel
|
122
121
|
# Channel to leave.
|
@@ -129,7 +128,7 @@ module Slack
|
|
129
128
|
end
|
130
129
|
|
131
130
|
#
|
132
|
-
#
|
131
|
+
# Lists all channels in a Slack team.
|
133
132
|
#
|
134
133
|
# @option options [Object] :exclude_archived
|
135
134
|
# Exclude archived channels from the list.
|
@@ -142,7 +141,7 @@ module Slack
|
|
142
141
|
end
|
143
142
|
|
144
143
|
#
|
145
|
-
#
|
144
|
+
# Sets the read cursor in a channel.
|
146
145
|
#
|
147
146
|
# @option options [channel] :channel
|
148
147
|
# Channel to set reading cursor in.
|
@@ -158,7 +157,7 @@ module Slack
|
|
158
157
|
end
|
159
158
|
|
160
159
|
#
|
161
|
-
#
|
160
|
+
# Renames a channel.
|
162
161
|
#
|
163
162
|
# @option options [channel] :channel
|
164
163
|
# Channel to rename.
|
@@ -176,7 +175,7 @@ module Slack
|
|
176
175
|
end
|
177
176
|
|
178
177
|
#
|
179
|
-
#
|
178
|
+
# Retrieve a thread of messages posted to a channel
|
180
179
|
#
|
181
180
|
# @option options [channel] :channel
|
182
181
|
# Channel to fetch thread from.
|
@@ -192,7 +191,7 @@ module Slack
|
|
192
191
|
end
|
193
192
|
|
194
193
|
#
|
195
|
-
#
|
194
|
+
# Sets the purpose for a channel.
|
196
195
|
#
|
197
196
|
# @option options [channel] :channel
|
198
197
|
# Channel to set the purpose of.
|
@@ -208,7 +207,7 @@ module Slack
|
|
208
207
|
end
|
209
208
|
|
210
209
|
#
|
211
|
-
#
|
210
|
+
# Sets the topic for a channel.
|
212
211
|
#
|
213
212
|
# @option options [channel] :channel
|
214
213
|
# Channel to set the topic of.
|
@@ -224,7 +223,7 @@ module Slack
|
|
224
223
|
end
|
225
224
|
|
226
225
|
#
|
227
|
-
#
|
226
|
+
# Unarchives a channel.
|
228
227
|
#
|
229
228
|
# @option options [channel] :channel
|
230
229
|
# Channel to unarchive.
|
@@ -6,25 +6,25 @@ module Slack
|
|
6
6
|
module Endpoints
|
7
7
|
module Chat
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# Deletes a message.
|
10
10
|
#
|
11
|
-
# @option options [timestamp] :ts
|
12
|
-
# Timestamp of the message to be deleted.
|
13
11
|
# @option options [channel] :channel
|
14
12
|
# Channel containing the message to be deleted.
|
13
|
+
# @option options [timestamp] :ts
|
14
|
+
# Timestamp of the message to be deleted.
|
15
15
|
# @option options [Object] :as_user
|
16
16
|
# Pass true to delete the message as the authed user. Bot users in this context are considered authed users.
|
17
17
|
# @see https://api.slack.com/methods/chat.delete
|
18
18
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.delete.json
|
19
19
|
def chat_delete(options = {})
|
20
|
-
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
21
20
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
21
|
+
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
22
22
|
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
23
23
|
post('chat.delete', options)
|
24
24
|
end
|
25
25
|
|
26
26
|
#
|
27
|
-
#
|
27
|
+
# Share a me message into a channel.
|
28
28
|
#
|
29
29
|
# @option options [channel] :channel
|
30
30
|
# Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.
|
@@ -39,34 +39,67 @@ module Slack
|
|
39
39
|
end
|
40
40
|
|
41
41
|
#
|
42
|
-
#
|
42
|
+
# Sends an ephemeral message to a user in a channel.
|
43
43
|
#
|
44
44
|
# @option options [channel] :channel
|
45
|
-
# Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
|
45
|
+
# Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
|
46
46
|
# @option options [Object] :text
|
47
47
|
# Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead.
|
48
|
+
# @option options [user] :user
|
49
|
+
# id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.
|
50
|
+
# @option options [Object] :as_user
|
51
|
+
# Pass true to post the message as the authed bot. Defaults to false.
|
52
|
+
# @option options [Object] :attachments
|
53
|
+
# A JSON-based array of structured attachments, presented as a URL-encoded string.
|
54
|
+
# @option options [Object] :link_names
|
55
|
+
# Find and link channel names and usernames.
|
48
56
|
# @option options [Object] :parse
|
49
57
|
# Change how messages are treated. Defaults to none. See below.
|
58
|
+
# @see https://api.slack.com/methods/chat.postEphemeral
|
59
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
|
60
|
+
def chat_postEphemeral(options = {})
|
61
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
62
|
+
throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
|
63
|
+
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
64
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
65
|
+
# attachments must be passed as an encoded JSON string
|
66
|
+
if options.key?(:attachments)
|
67
|
+
attachments = options[:attachments]
|
68
|
+
attachments = JSON.dump(attachments) unless attachments.is_a?(String)
|
69
|
+
options = options.merge(attachments: attachments)
|
70
|
+
end
|
71
|
+
post('chat.postEphemeral', options)
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# Sends a message to a channel.
|
76
|
+
#
|
77
|
+
# @option options [channel] :channel
|
78
|
+
# Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
|
79
|
+
# @option options [Object] :text
|
80
|
+
# Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead.
|
81
|
+
# @option options [Object] :as_user
|
82
|
+
# Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
|
83
|
+
# @option options [Object] :attachments
|
84
|
+
# A JSON-based array of structured attachments, presented as a URL-encoded string.
|
85
|
+
# @option options [Object] :icon_emoji
|
86
|
+
# 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 below.
|
87
|
+
# @option options [Object] :icon_url
|
88
|
+
# 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 below.
|
50
89
|
# @option options [Object] :link_names
|
51
90
|
# Find and link channel names and usernames.
|
52
|
-
# @option options [Object] :
|
53
|
-
#
|
91
|
+
# @option options [Object] :parse
|
92
|
+
# Change how messages are treated. Defaults to none. See below.
|
93
|
+
# @option options [Object] :reply_broadcast
|
94
|
+
# Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
|
95
|
+
# @option options [Object] :thread_ts
|
96
|
+
# Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
|
54
97
|
# @option options [Object] :unfurl_links
|
55
98
|
# Pass true to enable unfurling of primarily text-based content.
|
56
99
|
# @option options [Object] :unfurl_media
|
57
100
|
# Pass false to disable unfurling of media content.
|
58
101
|
# @option options [Object] :username
|
59
102
|
# Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
|
60
|
-
# @option options [Object] :as_user
|
61
|
-
# Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
|
62
|
-
# @option options [Object] :icon_url
|
63
|
-
# 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 below.
|
64
|
-
# @option options [Object] :icon_emoji
|
65
|
-
# 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 below.
|
66
|
-
# @option options [Object] :thread_ts
|
67
|
-
# Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
|
68
|
-
# @option options [Object] :reply_broadcast
|
69
|
-
# Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
|
70
103
|
# @see https://api.slack.com/methods/chat.postMessage
|
71
104
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.postMessage.json
|
72
105
|
def chat_postMessage(options = {})
|
@@ -82,16 +115,20 @@ module Slack
|
|
82
115
|
end
|
83
116
|
|
84
117
|
#
|
85
|
-
#
|
118
|
+
# Provide custom unfurl behavior for user-posted URLs
|
86
119
|
#
|
87
120
|
# @option options [channel] :channel
|
88
121
|
# Channel ID of the message.
|
89
122
|
# @option options [timestamp] :ts
|
90
123
|
# Timestamp of the message to add unfurl behavior to.
|
91
124
|
# @option options [Object] :unfurls
|
92
|
-
# JSON
|
125
|
+
# URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl message attachments.
|
126
|
+
# @option options [Object] :user_auth_message
|
127
|
+
# Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior.
|
93
128
|
# @option options [Object] :user_auth_required
|
94
129
|
# Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain.
|
130
|
+
# @option options [Object] :user_auth_url
|
131
|
+
# Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.
|
95
132
|
# @see https://api.slack.com/methods/chat.unfurl
|
96
133
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.unfurl.json
|
97
134
|
def chat_unfurl(options = {})
|
@@ -103,28 +140,28 @@ module Slack
|
|
103
140
|
end
|
104
141
|
|
105
142
|
#
|
106
|
-
#
|
143
|
+
# Updates a message.
|
107
144
|
#
|
108
|
-
# @option options [timestamp] :ts
|
109
|
-
# Timestamp of the message to be updated.
|
110
145
|
# @option options [channel] :channel
|
111
146
|
# Channel containing the message to be updated.
|
112
147
|
# @option options [Object] :text
|
113
148
|
# New text for the message, using the default formatting rules.
|
149
|
+
# @option options [timestamp] :ts
|
150
|
+
# Timestamp of the message to be updated.
|
151
|
+
# @option options [Object] :as_user
|
152
|
+
# Pass true to update the message as the authed user. Bot users in this context are considered authed users.
|
114
153
|
# @option options [Object] :attachments
|
115
|
-
#
|
116
|
-
# @option options [Object] :parse
|
117
|
-
# Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.
|
154
|
+
# A JSON-based array of structured attachments, presented as a URL-encoded string.
|
118
155
|
# @option options [Object] :link_names
|
119
156
|
# Find and link channel names and usernames. Defaults to none. This parameter should be used in conjunction with parse. To set link_names to 1, specify a parse mode of full.
|
120
|
-
# @option options [Object] :
|
121
|
-
#
|
157
|
+
# @option options [Object] :parse
|
158
|
+
# Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.
|
122
159
|
# @see https://api.slack.com/methods/chat.update
|
123
160
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.update.json
|
124
161
|
def chat_update(options = {})
|
125
|
-
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
126
162
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
127
163
|
throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
|
164
|
+
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
128
165
|
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
129
166
|
# attachments must be passed as an encoded JSON string
|
130
167
|
if options.key?(:attachments)
|