Comments (10)
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 🙏
from nestjs-slack.
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?
from nestjs-slack.
#271 might be relevant here as well?
from nestjs-slack.
it's similar, but why not just allow for a getter like follows:
Just expose client
instance on the class, where class is the WebClient. in this way we can just use all of the sdk modules like so:
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
from nestjs-slack.
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;
}
from nestjs-slack.
I like it! Let's try and see how that would look :)
Would love to see a MR/PR :)
from nestjs-slack.
from nestjs-slack.
@cobraz 🙏
from nestjs-slack.
I think the double ^^
in your package.json is preventing me from installing the module directly from the repo:
❯ npm i --save https://github.com/bjerkio/nestjs-slack.git
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /Users/benneigher/.nvm/versions/node/v18.12.1/bin/node /Users/benneigher/.nvm/versions/node/v18.12.1/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/benneigher/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code EINVALIDTAGNAME
npm ERR! npm ERR! Invalid tag name "^^9.0.0" of package "@nestjs/platform-express@^^9.0.0": Tags may not have any characters that encodeURIComponent encodes.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /Users/benneigher/.npm/_logs/2023-01-31T19_28_09_518Z-debug-0.log
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/benneigher/.npm/_logs/2023-01-31T19_27_59_836Z-debug-0.log
Specifically this line in package.json @nestjs/platform-express@^^9.0.0
from nestjs-slack.
+1 on publish a new version
from nestjs-slack.
Related Issues (16)
- Question - Multiple Webhooks possible? HOT 11
- Nest v9 not supported HOT 5
- How to work with webhook? HOT 3
- Making nestjs-slack a pure ESM package HOT 2
- How to mock / provide SlackModuleOptions for nestjs testing? HOT 2
- How to instantiate the SlackService class in main.ts HOT 2
- postMessage returns void instead of response HOT 1
- Node-fetch - Only absolute URL are supported? HOT 6
- Missing function postEphemeral in the service.
- Dependency Dashboard
- Replace axios with fetch HOT 1
- provide example of sending message built by slack-block-builder HOT 2
- ERROR [ExceptionsHandler] An API error occurred: not_authed HOT 4
- Remove Google Cloud logger dependency? HOT 3
- WebClient not available
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nestjs-slack.