Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@cmdotcom/text-sdk
Advanced tools
Package to make it very easy to send text messages with CM.com
Want to send text-messages in your Node.js application? Then you are at the right place.
The package is currently limited in features compared to the CM gateway, but if you want to get all the functionalities, go to: CM.com API Docs
First, run npm install @cmdotcom/text-sdk
. Then, in your source file:
const messagingApi = require("@cmdotcom/text-sdk");
// Get your product token at CM.com.
const yourProductToken = "";
const myMessageApi = new messagingApi.MessageApiClient(yourProductToken);
const result = myMessageApi.sendTextMessage(["00316012345678"], "TestSender", "Hello world?!");
result.then((result) => {
console.log(result);
}).catch((error) => {
console.log(error);
});
or send multiple
const result = myMessageApi.sendTextMessage(["00316012345678","003160000000"], "TestSender", "Hello world?!");
send rich messages using the message builder
const richMessage = {
media: {
mediaName: "cm.com",
mediaUri: "https://avatars3.githubusercontent.com/u/8234794?s=200&v=4"
},
text: "Our logo!"
};
const suggestion = {
action: "openUrl",
label: "Click me",
url: "https://www.cm.com"
};
const response = client.createMessage()
.setMessage(["00316012345678"], "TestSender", "Hello world?!")
.setAllowedChannels(["Viber"])
.setConversation([richMessage])
.setSuggestion([suggestion])
.send();
response.then((result) => {
console.log(result);
}).catch((error) => {
console.log(error);
});
or send whatsapp template messages using the message builder
const template = {
whatsapp: {
elementName: 'template-name',
language: {
code: 'en',
policy: 'deterministic'
},
namespace: 'the-namespace-of-template',
components: [{
type: 'body',
parameters: [{
type: 'text',
text: 'firstname'
}]
}]
}
};
const response = client.createMessage()
.setMessage(["00316012345678"], "TestSender", "Hello world?!")
.setAllowedChannels(["WhatsApp"])
.setTemplate(template)
.send();
response.then((result) => {
console.log(result);
}).catch((error) => {
console.log(error);
});
or send whatsapp interactive messages using the message builder
const whatsAppInteractiveContent = {
type: 'list',
header: {
type: "text",
text: "your-header-content"
},
body: {
text: "your-text-message-content"
},
footer: {
text: "your-footer-content"
},
action: {
button: "cta-button-content",
sections: [{
title: "your-section-title1",
rows: [{
id: "unique-row-identifier1",
title: "row-title-content",
description: "row-description-content"
}]
},
{
title: "your-section-title2",
rows: [{
id: "unique-row-identifier2",
title: "row-title-content",
description: "row-description-content"
}]
}
]
}
};
const response = client.createMessage()
.setMessage(["00316012345678"], "TestSender", "Hello world?!")
.setAllowedChannels(["WhatsApp"])
.setInteractive(whatsAppInteractiveContent)
.send();
response.then((result) => {
console.log(result);
}).catch((error) => {
console.log(error);
});
@cmdotcom/text-sdk is under the MIT license. See LICENSE file.
[2.1.0] - 2024-06-13
FAQs
Package to make it very easy to send text messages with CM.com
The npm package @cmdotcom/text-sdk receives a total of 1,081 weekly downloads. As such, @cmdotcom/text-sdk popularity was classified as popular.
We found that @cmdotcom/text-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.