Preprocessing
How to add a CSML preprocessor
exports.handler = async (event) => {
const text = event.content.text;
if (text.toLowerCase().includes('hot dog')) {
return {
content_type: 'image',
content: {
P url: 'https://media.istockphoto.com/photos/hot-dog-on-white-picture-id1130731707',
_original_event: event,
},
};
}
return {
content_type: 'text',
content: {
text: 'Not hot dog!',
_original_event: event,
},
};
};



Last updated
Was this helpful?