-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Expose the WebClient to make other REST API calls #282
Comments
Thanks for posting this. I love the idea of exposing the WebClient instance, for sure! Do you have an idea for how the API could look like? |
#271 might be relevant here as well? |
it's similar, but why not just allow for a getter like follows: Just expose import { Injectable } from '@nestjs/common'
import { SlackService } from 'nestjs-slack'
@Injectable()
export class MyService {
constructor(
private slackService: SlackService
) {}
async myFunction(email) {
const userResponse = await this.slackService.client.users.lookupByEmail(<>) // .client
return userResponse.user
} I can see about making a MR if you think this approach is OK |
I think all that needs to change is making client public actually: export declare class SlackService<C = Channels> {
private readonly options: SlackConfig;
public readonly client: WebClient; // <-- HERE
private readonly log: LogSync;
constructor(options: SlackConfig, client: WebClient | null, log: LogSync | null);
sendText(text: string, opts?: Omit<SlackMessageOptions<C>, 'text' | 'blocks'>): Promise<void>;
sendBlocks(blocks: Readonly<SlackBlockDto>[], opts?: Omit<SlackMessageOptions<C>, 'blocks'>): Promise<void>;
postMessage(req: SlackMessageOptions<C>): Promise<void>;
private runApiRequest;
private runWebhookRequest;
private runStdoutRequest;
private runGoogleLoggingRequest;
} |
I like it! Let's try and see how that would look :) Would love to see a MR/PR :) |
@cobraz 🙏 |
I think the double
Specifically this line in package.json |
alternatively -- if you published a new release to npm I will be out of your hair! Putting together a release and would prefer using the nestjs module over the slack sdk manually. much appreciated 🙏 |
+1 on publish a new version |
Hello, just wondering if it's possible to add a getter to the
SlackService
to allow the application to get a hold of the WebClient instance? I want to use it to make calls to users apis (lookupByEmail
for example)Doesn't seem to be a way to do this without installing
@slack/web-api
and making an external instance of the WebClientLove the repo!
The text was updated successfully, but these errors were encountered: