Typescript classes and types to use Dialogflow Messenger Integration in Typescript. Please check the Official Dialogflow CX Messenger Integration documentation for more information.
To install:
npm install dialogflow-cx-messenger-ts
or
yarn add dialogflow-cx-messenger-ts
Once installed, you can import the types and use them in your code:
import * as dfcxmessenger from 'dialogflow-cx-messenger-ts';
Then you can use it to create a response:
const response = {};
const content = new dfcxmessenger.RichContent();
const richContentElement = new dfcxmessenger.RichContentElement();
richContentElement.type = "image";
richContentElement.rawUrl = "https://example.com/images/logo.png";
richContentElement.accessibilityText = "Example logo";
content.richContent = [[richContentElement]];
response.fulfillmentResponse = {
messages: [{
text: {
text: [
information,
],
},
},
{
payload: content,
}],
};
You can find the documentation here.
You can find an example here
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure that read the Contributing file.
Does your company use this package? Help keep the project bug-free and feature rich by sponsoring the project.
This project exists thanks to all the people who contribute. Check our contributing guidelines. Check all contributors here.