Comments (3)
@gerardovf yes, I guess the node-red ui will eat all your special chars but you can prepare the payload in an upstream function node, something like
msg.payload = {
message: 'The message with the buttons',
buttons: [
{
value: 'text 1',
label: 'label of the button 1',
answer: 'this is the answer',
alert: true,
newLine: true
},
{
value: 'text 2',
label: 'another label',
answer: 'this is the answer 2',
alert: false
}
]
}
return msg;
from node-red-contrib-chatbot.
@guidone You were right!! Now only the 'newLine' is still not working... (I wanted to show a 2x2 buttons keyboard)
I used this page to get the emoji conversion: http://www.fileformat.info/info/unicode/char/search.htm
Then in the upstream function node I inserted:
console.log(msg);
var chat = msg.chat();
var cloned = RED.util.cloneMessage(msg);
cloned.payload = {
type: "buttons",
content: 'The message with the buttons',
messageId: null,
chatId: chat.get('chatId'),
buttons: [
{
value: '\uD83D\uDD06\nON1',
label: 'label of the button 1',
answer: 'this is the answer',
alert: true,
newLine: false
},
{
value: '\u2B06\nON2',
label: 'another label',
answer: 'this is the answer 2',
alert: false,
newLine: true
},
{
value: '\uD83D\uDD05\nOFF1',
label: 'label of the button 3',
answer: 'this is the answer 3',
alert: true,
newLine: false
},
{
value: '\u2B07\nOFF2',
label: 'another label 2',
answer: 'this is the answer 4',
alert: false,
newLine: true
}
]
}
return cloned;
from node-red-contrib-chatbot.
@guidone I also checked that 'newLine' is working with "inline-buttons"
console.log(msg);
var chat = msg.chat();
var cloned = RED.util.cloneMessage(msg);
cloned.payload = {
type: "inline-buttons",
content: 'The message with the buttons',
messageId: null,
chatId: chat.get('chatId'),
buttons: [
{
value: '\uD83D\uDD06\nON1',
label: '\uD83D\uDD06\nON1',
answer: 'this is the answer',
newLine: false
},
{
value: '\u2B06\nON2',
label: '\u2B06\nON2',
answer: 'this is the answer 2',
newLine: true
},
{
value: '\uD83D\uDD05\nOFF1',
label: '\uD83D\uDD05\nOFF1',
answer: 'this is the answer 3',
newLine: false
},
{
value: '\u2B07\nOFF2',
label: '\u2B07\nOFF2',
answer: 'this is the answer 4',
newLine: true
}
]
}
return cloned;
from node-red-contrib-chatbot.
Related Issues (20)
- Documentation: Changelog is being populated with 'Untitled'
- Feature request: add phone number information HOT 1
- feature request: linkedin messenger
- npm ERR! errno ETIMEDOUT HOT 1
- Snyk vulnerabilities HOT 1
- Image URL param support?
- Telegram Webhook not responding
- An example of how to create mediaGroup?
- Telegram pinned_message
- MC not working in Docker HOT 1
- Viber Images
- install error on node red on pi HOT 6
- Uncaught Exception in Text node HOT 1
- Unable to install from Palette / Docker HOT 3
- Can I use this package to integrate with home-made web-app bot?
- FR: Support MarkdownV2 in Telegram messages.
- Elements not recognized
- Could not login to Mission Control
- FR: Support for Telegram reactions
- Tutorial for messenger
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 node-red-contrib-chatbot.