N
Novu8mo ago
Giøn

Sending a chat message using GetStream

Hello, how can I use Stream to send a chat message to a subscriber? I see that stream has been added as a provider ( https://github.com/novuhq/novu/issues/4679 ). I've already set it up in my integrations store, but I can't find any guide/example on how to use it. The integration points to https://getstream.io/chat/docs/node/?language=javascript but it's not really helpful. Thanks!
GitHub
🚀 Feature: Add GetStream as a Chat Provider · Issue #4679 · novuhq/...
🔖 Feature description Use the GetStream docs to create a new chat provider while following Novu's guide to a new provider 🎤 Why is this feature needed ? more options for the community ✌️ How do...
3 Replies
Zac Clifton
Zac Clifton8mo ago
Just from looking at the PR you would add your api. Then since it is a chat provider you will need to create a subscriber with the data for the specific stream, and have the workflow use the getstream provider to send to that subscriber Here is an example script for discord tha works the same way
import { Novu, ChatProviderIdEnum } from '@novu/node';

const novu = new Novu("<apikey>");

const subscriberId = 'Discord-Alert'

novu.subscribers.identify(subscriberId,{})
.then(() => {
console.log('Identified successfully');
}).catch((error) => {
console.error('Error creating', error);
})

novu.subscribers.setCredentials(subscriberId, ChatProviderIdEnum.Discord, {
webhookUrl: '<webhook>',
}).then(() => {
console.log('Credentials set successfully');
}).catch((error) => {
console.error('Error setting credentials', error);
})
import { Novu, ChatProviderIdEnum } from '@novu/node';

const novu = new Novu("<apikey>");

const subscriberId = 'Discord-Alert'

novu.subscribers.identify(subscriberId,{})
.then(() => {
console.log('Identified successfully');
}).catch((error) => {
console.error('Error creating', error);
})

novu.subscribers.setCredentials(subscriberId, ChatProviderIdEnum.Discord, {
webhookUrl: '<webhook>',
}).then(() => {
console.log('Credentials set successfully');
}).catch((error) => {
console.error('Error setting credentials', error);
})
Giøn
Giøn8mo ago
Hello @Zac Clifton , thank you for your reply. So if I understand correctly, the data that I would need to add to a subscriber is a webhook URL, which will be used when sending a message (https://github.com/novuhq/novu/pull/4692/files#diff-35f9b2ecd35141410fa0c9dd8ef020de8458e1f9ed6a3bead1abc6003d426e25R22-R35 ). It looks to me that the format is not the one documented in the stream API documentation https://getstream.io/chat/docs/rest/#messages-sendmessage. I'm not really an expert with the stream API, but I'm not able to understand exactly what this webhookURL is. A way to us it would require to create a new endpoint on my backend which will accept these requests and sends the message to the channel and the originator that I want to use. What do you think?
GitHub
feat: add getstream by vikaspatil0021 · Pull Request #4692 · novuhq...
What change does this PR introduce? fixes #4679 Added GetStream as chat provider
Novu_Bot
Novu_Bot8mo ago
@Giøn, you just advanced to level 1!
Want results from more Discord servers?
Add your server