23 lines
		
	
	
		
			522 B
		
	
	
	
		
			TypeScript
		
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			522 B
		
	
	
	
		
			TypeScript
		
	
	
	
import zulip from "zulip-js";
 | 
						|
 | 
						|
export const sendMessToZulip = async (type, to, topic, content) => {
 | 
						|
  try {
 | 
						|
    const config = {
 | 
						|
      username: "networktool-bot@zulip.ipsupply.com.au",
 | 
						|
      apiKey: "0jMAmOuhfLvBqKJikv5oAkyNM4RIEoAM",
 | 
						|
      realm: "https://zulip.ipsupply.com.au",
 | 
						|
    };
 | 
						|
    const client = await zulip(config);
 | 
						|
    let params = {
 | 
						|
      type: type,
 | 
						|
      to: to,
 | 
						|
      topic: topic,
 | 
						|
      content: content
 | 
						|
    };
 | 
						|
 | 
						|
    await client.messages.send(params);
 | 
						|
  } catch (error) {
 | 
						|
    console.log(error);
 | 
						|
  }
 | 
						|
};
 |