kopia lustrzana https://github.com/ToolJet/ToolJet
commit
a63a4639bf
2
.version
2
.version
|
@ -1 +1 @@
|
|||
2.1.1
|
||||
2.1.2
|
||||
|
|
|
@ -12,9 +12,10 @@ const Slack = ({ optionchanged, createDataSource, options, isSaving, selectedDat
|
|||
const provider = 'slack';
|
||||
setAuthStatus('waiting_for_url');
|
||||
|
||||
let scope = 'chat:write,users:read,channels:read,channels:history';
|
||||
let scope =
|
||||
'users:read,channels:read,groups:read,im:read,mpim:read,channels:history,groups:history,im:history,mpim:history';
|
||||
if (options.access_type === 'chat:write') {
|
||||
scope = `${scope},chat:write:bot,chat:write:user`;
|
||||
scope = `${scope},chat:write`;
|
||||
}
|
||||
|
||||
datasourceService.fetchOauth2BaseUrl(provider).then((data) => {
|
||||
|
|
|
@ -65,19 +65,26 @@ export default class SlackQueryService implements QueryService {
|
|||
break;
|
||||
|
||||
case 'send_message': {
|
||||
const body = {
|
||||
channel: queryOptions.channel,
|
||||
text: queryOptions.message,
|
||||
as_user: queryOptions.sendAsUser,
|
||||
};
|
||||
if (sourceOptions.access_type === 'chat:write') {
|
||||
const body = {
|
||||
channel: queryOptions.channel,
|
||||
text: queryOptions.message,
|
||||
as_user: queryOptions.sendAsUser,
|
||||
};
|
||||
|
||||
response = await got('https://slack.com/api/chat.postMessage', {
|
||||
method: 'post',
|
||||
json: body,
|
||||
headers: this.authHeader(accessToken),
|
||||
});
|
||||
response = await got('https://slack.com/api/chat.postMessage', {
|
||||
method: 'post',
|
||||
json: body,
|
||||
headers: this.authHeader(accessToken),
|
||||
});
|
||||
|
||||
result = JSON.parse(response.body);
|
||||
result = JSON.parse(response.body);
|
||||
} else {
|
||||
result = {
|
||||
ok: false,
|
||||
error: 'You do not have the required permissions to perform this operation',
|
||||
};
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
export type SourceOptions = {
|
||||
access_token: string;
|
||||
access_type: 'chat:write' | 'read';
|
||||
};
|
||||
export type QueryOptions = {
|
||||
operation: string;
|
||||
|
|
Ładowanie…
Reference in New Issue