Git Product home page Git Product logo

dialogflow-integrations's Introduction

Dialogflow Integration

Introduction

The purpose of this documentation is to set up an integration deployment to connect your existing Dialogflow agent to various third party chat service platforms.

If you do not have an existing Dialogflow agent, you can set one up by reading the documentation here.

Although it is possible to set up this integration deployment on any hosting platform, these instructions will use Google's Cloud Run.

Initial Setup

Setting up gcloud CLI

The deployment process for GCP Cloud Run via this README utilizes gcloud CLI commands. Follow the steps below to set up gcloud CLI locally for this deployment.

  1. On the gcloud CLI documentation page, select your OS and follow the instructions for the installation.
  2. Run gcloud config get-value project to check the GCP Project configured.
  3. Go into the Dialogflow agent’s settings and check the Project ID associated with the agent. The GCP Project configured in the gcloud CLI should match the agent’s Project ID.
  4. If the project IDs do not match, run gcloud config set project PROJECT-ID, replacing PROJECT-ID with the Project ID from step 3.

Service Account Setup (GCP)

For the integration to function properly, it is necessary to create a Service Account in your agent’s GCP Project. See this page of the documentation for more details.

Follow the steps below to create a Service Account and set up the integration.

  1. Go into the Dialogflow agent’s settings and click on the Project ID link to open its associated GCP Project.
  2. Click on the navigation menu in the GCP console, hover over "IAM & admin", and click "Service accounts".
  3. Click on "+ CREATE SERVICE ACCOUNT", fill in the details, and give it the "Dialogflow API Client" role.

If deploying this integration outside of GCP, you may authenticate using a key file. Deploying on Cloud Run or Cloud Functions obviates this process.

  1. Click on "+ Create Key" and download the resulting JSON key file.
  2. Save the JSON key file in the desired platform subdirectory.
  3. Set the GOOGLE_APPLICATION_CREDENTIALS environmental variable on the deployment environment to the absolute path of Service Account JSON key file. See this guide for details.

Deploying the Integration

Setup

  1. Go into the Dialogflow agent’s settings and click on the Project ID link to open its associated GCP Project.
  2. Click on the navigation menu in the GCP console and click "Billing". Set up and enable billing for the project.
  3. Enable Cloud Build and Cloud Run API for the project here.
  4. Clone this git repository onto your local machine or development environment: git clone [repository url]
  5. Open the root directory of the repository on your local machine or development environment.

Dockerfile and Creating the Build

Open the Dockerfile in the root directory of the repository, and change YOUR_INTEGRATION in the following line to the name of the desired platform subdirectory.

   # Set this environmental variable to the integration you want to use
   ENV INTEGRATION=YOUR_INTEGRATION

If you have not done so already, copy your Service Account JSON key file to the desired platform subdirectory.

Platform-specific Instructions

The integration requires platform credentials from the intended platform to function properly.

Follow the steps in the README file in the relevant platform subdirectory to obtain the credentials and setup the server.js file to deploy and start the integration:

Post-deployment

Shutting Down an Integration

In order to shut down an integration set up via the steps in this README, only deleting the Cloud Run service is required.

In your local terminal, run the following command and select the previously chosen target platform to list active deployments:

gcloud beta run services list

Then run the following command, replacing SERVICE-NAME with the name of the service you want to shut down, and select the same settings chosen when deploying in order to shut down the deployment.

gcloud beta run services delete SERVICE-NAME

If following the instructions closely, SERVICE-NAME should be in the format of dialogflow-PLATFORM

Multiple Integrations

To set up multiple integration deployments simultaneously, repeat all of the instructions for each deployment. While it is possible to make changes to the existing deployment repository and re-deploy it under a different name, it would make it difficult to retroactively make changes to previous deployments.

Changing Integration Behavior

The behavior of an integration can be customized via the addition of your own developer code or by editing the server.js file in the platform subdirectory.

After making changes, redeploy the deployment by re-running the commands as specified in the "Deploy the Integration Using Cloud Run" section of the platform-specific integration READMEs.

dialogflow-integrations's People

Contributors

chihhsuan-google avatar galz10 avatar henopied avatar jiayuandeng avatar joepb avatar josobar avatar jrash06 avatar jrereyi2000 avatar leulaf avatar mekpavit avatar parvezshaikhquantiphi avatar peterfishergcp avatar rdouglas202 avatar sapient007 avatar sreniawski avatar svetlanap-google avatar tyhu-google avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dialogflow-integrations's Issues

Passing contexts

There seems no way to pass contexts via this library to the actual detectIntent call. Value in this is if you want to maintain context over a long period of time (where Dialogflow would timeout).

Could the constructor and related function definitions not be changed to include this along lines of:

//add additional input variable below
constructRequest(text, sessionPath, payload, prevContexts) {
return {
session: sessionPath,
queryInput: {
text: {
text: text,
languageCode: 'en'
}
},
queryParams: {
payload: payload,
// Add context to queryParams
contexts: prevContexts
}
};
}

Dialogflow Knowledge base data is not send in response for Twilio

I have completed the integration as per the documentation when i try to run the bot by asking the question which is provided in the knowledge base it doesn't send reply. Instead, it sends only the default fallback intent response.

If i revert back the normal i am getting the response properly.

How to integrate Dialogflow with Microsoft Teams.

As I have noticed in official document, Teams integration is not part of built in integrations supported by Google. It being an independent integration, can someone help me with trusted third party organization to do the same?

twitter integration open source

I am trying to do open source integration with twitter and twilio .the twilio integration for the agent is successfull and twitter integration I had done with one of the app is also successfull. But when I try to integrate with another twitter app it is showing the log

2020-05-05 15:23:05.478 IST> [email protected] start /usr/src/app/twitter
2020-05-05 15:23:05.478 IST> node server.js
2020-05-05 15:23:05.478 IST
2020-05-05 15:23:06.872 ISTYour Twitter integration server is listening on port 8080
2020-05-05 15:23:11.930 ISTGET200419 B12 msUnknown https://dialogflow-twitter-z6y**pq-uc.a.run.app/?crc_token=MmVjYTg0ZGQtYjY2NC00YThhLWJjZNzA3MDBi&nonce=MTU4ODYNNOORMjM5MTg3NA

Can someone help me to figure out the issue?

Setting Environment to use with Integration

On the console, we are able to specify which environment to deploy to a particular integration and we are able to deploy incrementally with versions. For instance: we have Draft, QA, Staging, and Production.

How do we do the same with Cloud Run? Right now it seems to just use whatever is in the draft.

Typo - dialgoflowSessionClient

dialgoflowSessionClient i.s.o. dialogflowSessionClient in Skype library
e.g line 37 of Skype/server.js :
"const sessionClient = new dialgoflowSessionClient(projectId);"

agent deployed successfully to twitter then after a while becomes inactive

I managed to follow the instructions to get my dialogflow agent re-integrated into twitter - it replies etc but when i message it a few hours later it becomes unresponsive and I have to redeploy. Any ideas?

in the long run I don't want to use cloud run after my free trial ends and want to be able to host a twitter integration on my own native machine - does anybody have any instructions on how to do this?

Thank you!

No outbound messages with Twilio text messaging service - Twilio Error code: 11200

I carefully followed the instructions for Twilio (Text Messaging ) and been successful till the last step of successful deployment on gcloud. I also have the URL being generated by executing gcloud run command and pasted it in Twilio "When a message comes in" field.

Now when I send a message to my active Twilio number on which sms services are being enabled, I only receive incoming messages which I can see in Twilio logs but no outgoing messages. In fact I receive an error code on Twilio: 11200 which is timeout error and nothing of google cloud logs other than successful deployment.

image

Below is the snippet of successful deployment.

image

Does anyone knows what's going on or what I am doing wrong? I followed the instructions multiple times though.

Unable to create Dialogflow bot in Nigerian Language

I am Unable to create a bot for my Nigerian client, basically, I have created my bot in the English language but the issue is Dialogflow is not recognizing Nigerian names.

I have tried to add around 50+ names in sys.person entity but still, there are many names which Dialogflow does not recognizes.

I can not use sys.any entity as it will create conflict with first name and last name etc (which also may lead error to occur), is there any other permanent solution as Dialogflow also recognizes other language names (i.e Pakistani/Indian names).

JsonToProto returns empty payload

jsonToProto functions seems to return proto object but when sent as request object to the fullfilment it returns empty payload.

const payload = {
data: {
SmsSid: "SM1eb889baa86d1887d14c6007a6c5684a",
Body: "Hola",
SmsStatus: "received",
MessageSid: "SM1eb889baa86d1887d14c6007a6c5684a",
ApiVersion: "2010-04-01",
From: "whatsapp:+5218717953912",
AccountSid: "ACf71ea17bda8928547c7f0fa3f13d384b",
NumMedia: "0",
To: "whatsapp:+14155238886",
SmsMessageSid: "SM1eb889baa86d1887d14c6007a6c5684a",
NumSegments: "1"
}
};

const request = {
  session: sessionPath,
  queryInput: {
    text: {
      text: "Hola",
      languageCode: LANGUAGE_CODE
    }
  },
  queryParams: {
    payload: this.jsonValueToProto(payload)
  }
};

Question about billing account

I have a question about the integration of twilio with dialogflow. In the instructions they ask me to activate a billing account .
If I activate it ... They will charge money only if I reach the quotas?
Can I still use the free service if I enable the billing account?

Thanks.

const accountSid

const accountSid = 'ACb1f6adf3f9168535dba12e868a76e2e4';
const authToken = '8ad710f6c283b9af4d719c62ce343f01';

How to change "language_code" for the Twilio (Text Messaging) Integration

I have a Dialogflow agent in pt-br, but Twilio is sending the query text with the "language_code": "en", so my agent can't find any intent. I just made the default integration using the gcloud sdk, and I was wondering, when or where I can change the language for this integration, so Twilio can send the "language_code" being "pt-br".

Successful Integration to Twilio But SMS Issues - Help Needed

Successfully completed a new integration of Dialogflow to Twilio since the current integration will be deprecated in April 2020. We followed all of the steps in the Repository and was able to get an intention to successfully run and send an SMS message from Dialogflow to Twilio and out to a text. The issue is that prior to the new integration Dialogflow allows for more than one response to a training phrase. So if the training phrase was "hi" then you can set up multiple responses that would send one after the other like a conversation vs one big sms response.

It looked like this:

image

Since doing the integration the response is only the last part "Let's get started what can I help you with"

When testing in Dialogflow on the google assistant it works correctly so it is something that is preventing the 3 responses to be sent from DF to Twillio and out to SMS.

Thank you for any help or ideas

Dialogflow send empty response to twilio when a new conversation is started

HelloWorld, I'm having an issue with dialogflow, it is sending empty responses to twilio when a new conversation start. Im getting the error Warning - 14103 Invalid Body in the twilio debugger.

  • Im sure the webhook is sending a response to dialogflow but dialogflow is sending an empty response to twilio.
  • The request takes less than one second
  • Dialogflow bot send rigth answers after the third interaction

image

this is an example of how im sending the responses from the webhook

image

Cannot send Images to whatsapp

My dialogflow agent is integrated with Twilio's Whatsapp service successfully. But whin the agent response contain an image, the Whatsapp wasn't be able to receive the image response. Is there any solution for that?

Twilio Integration INVALID_ARGUMENT

i got this error:

Error: 3 INVALID_ARGUMENT: Input text not set.
at Object.exports.createStatusError (/srv/node_modules/grpc/src/common.js:91:15)
at Object.onReceiveStatus (/srv/node_modules/grpc/src/client_interceptors.js:1209:28)
at InterceptingListener._callNext (/srv/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/srv/node_modules/grpc/src/client_interceptors.js:618:8)
at callback (/srv/node_modules/grpc/src/client_interceptors.js:847:24)

this error only appear when i send blob via twilio integration. how to fix this?

###Chatbot

const accountSid = 'ACb1f6adf3f9168535dba12e868a76e2e4';
const authToken = '8ad710f6c283b9af4d719c62ce343f01';

Integration with Twilio+Whatsapp successful but response from webhook not reaching WhatsApp

I've completed the integration with Twilio (for WhatsApp) as per the instructions and I'm able to get responses from my dialogflow agent for any intent that does not have webhook fulfillment (in my case it's a node.js app).

Any intent that has a webhook fulfillment, it sends only the default text response from the agent, even though the node.js webhook is receiving the request and sends a successful response, I'm getting only the default response from agent in WhatsApp through Twilio.

Can someone help on this?

Dialogflow integration with skype/teams

I have integrated Dialogflow with Microsoft Teams as per the instructions here. It works fine. I want to add calendar integration as well. When I try to do this with separate cloud function/cloud run, it works fine in the Dialogflow console but when I test in teams, it creates a calendar event but there is no response from webhook to teams (I get the webhook response only in Dialogflow console). This is probably because the teams doesn't recognize a normal message, it has to be converted to a skype message. This is the response back from webhook:

conv.ask('Ok, let me see if we can fit you in.');

How do I convert this particular message to skype message using node js?

Integration with Cisco WebEx (former Spark)

Hi everyone,

I´ve integrated with Cisco WebEx and it is working pretty well. But one thing I´ve noticed is that using multiple Text Response sections doesn´t work as expected. I am configuring these responses for Default Welcome Intent:

default-responses

It works like a charm when I use Try It Now:

image

But in WebEx it doens´t work. It seems the 2 sections os responses are merged as single one and then a single response is provided:

image

What do you think??

Thanks in advanced!!

Best,
Rafael Guedes

unable to evaluate symlinks

while executing the command
gcloud builds submit --tag gcr.io/PROJECT-ID/dialogflow-PLATFORM
an error occurs
unable to evaluate symlinks in Dockerfile path: lstat /workspace/Dockerfile: no such file or directory

Customize the height of the chat widget of Dialogflow messenger integration

I am using Dialogflow's new website integration "Dialogflow messenger". Everything is working fine but when I click on the chat widget the height of the chat window is exceeding the size of the browser window as you can see in the attached snapshot.
Screenshot from 2020-08-13 16-15-12

I have read out the official documentation CSS customization of this chat widget but I couldn't found any useful method to handle this issue. I have tried with different browsers like firefox, chrome, safari, etc. But the issue remains the same. The documentation provides only the following CSS variables which don't help out too much.

image

I will encourage if anyone can provide a solution to this. Thank you

high latency of detectintent

I am testing viberbot, key file is set to environment.
I am using ngrok for test chat bot in local.

The issue is when calling detectIntent it will take nearly 8 seconds to get seponse.
const answer = (await sessionClient.detectIntent(message.text, sessionId, message))
Any reason for this ?

Spark blocked due to multiple webhooks / sec

My Dialogflow API was integrated with Spark/Webex and worked for 2 years, then it was blocked because:

(Webex Developer Support) "We had to check with engineering on this and found that your bot had been blocked due to it creating multiple webhooks per second. That would mean that something in your code is causing webhooks to constantly be created for some reason. Do you have a way of seeing why this was happening?"

(Dialogflow Support reply) "Regarding the code that may cause webhooks to constantly be created, unfortunately, we are unable to assist as the issue is more closely related to the open source integration code. For issues related to the open source integration, kindly report the issue in the issues section of Github."

All my other integrations work fine (or do not worry about the multiple webhooks) though I don't know if it's been a long-term issue but Spark only just started monitoring that problem.

Agent Resource type returns null in Dialogflow Fulfilment

I have used cloud functions for my action. Based on the agent resource type, I am sending the response back. As per the guidelines provided in the document i have changed the Twilio integration.
After deployment when i check the agent.requestSource type it returns null. Earlier it returns 'twilio' or 'GOOGLE_ASSISTANT' but now it returns null.

Logs:
Click here to view it

Implementation Code

exports.dialogflowFirebaseFulfillment = functions.https.onRequest(
  (request, response) => {
    console.log("Dialogflow Request body: ", request.body);
    const agent = new WebhookClient({ request, response });
    console.log("agent originalRequest", agent.originalRequest);
    console.log("Agent resource", agent.requestSource);
    const conv = agent.conv();
    let sender;
    let receiver;

    if (agent.requestSource === "twilio") {
      const requestBody = request.body;
      sender = requestBody.originalDetectIntentRequest.payload.data.From;
      receiver = requestBody.originalDetectIntentRequest.payload.data.To;
    }
........

Twilio deployed successfully but URL not Responding

Following the steps in the ReadMe doc, I managed to deploy Twilio integration and I received:

Service [dialogflow-twilio] revision [dialogflow-twilio-00001-fiy] has been deployed and is serving 100 percent of traffic at https://dialogflow-twilio-xxxxxxxxxxx-uc.a.run.app

but the URL generated is not responding and when I pinged it I got Service Unavailable response.

When I checked the Log on Cloud Run, I could see:

2020-02-04T09:37:11.169611ZPOST503556 B127.7 sTwilioProxy/1.1 https://dialogflow-twilio-xxxxxxxxxxx-uc.a.run.app/
The request failed because the HTTP connection to the instance had an error.

The application does not receiving events from the twitter app

Hi,

Already have an agent that uses the inbuilt integration with twitter. Because of the deprecation warnings, I tried to use this open-sourced integration. Done everything as said in the instructions. It is deployed in Cloud Run. I even created a new app on twitter when the existing twitter app didn't work. But no luck so far. There are no requests coming to the cloud run logs.

In short, the bot is down. I need some help urgently.

Regards.
Jyothish G

Dialogflow integration with teams - Extract user information

We are trying to integrate Dialogflow chatbot with Microsoft Teams. We followed this tutorial (https://github.com/GoogleCloudPlatform/dialogflow-integrations/tree/master/skype)
We got to a point where we’re able to send text-based basic intent mapped questions, and they’re working flawlessly.

Is there a way to extract user information out of Teams?

For example, in the Welcome Intent, instead of bot saying “Hello user”, is there a way to make it say “Hello John”?

A little bit of research led us to this (#37 (comment)) but we find it a little bit confusing. Are we supposed to develop a method to handle incoming requests within dialoglow-integration/server.js? If so, where should we look for the said user information? Any pointers will help.

TIA.

Deploying the Integration Using Cloud Run

I advance the instructions with no problem until , Platform-specific Instructions/Twilio (Text Messaging) Integration

and then--

In your local terminal, change the active directory to the repository’s root directory.

// Does this mean, al the files that I changed, like dockerfile and server.js file, do I move them to C:\Users***\AppData\Local\Google\Cloud SDK and then run the following commands???

Run the following command to save the state of your repository into GCP Container Registry. Replace PROJECT-ID with your agent’s GCP Project ID and PLATFORM with the platform subdirectory name.

because I did and GCP Container Registry got fulled with some stuff and then continue the instructions and apply the following code and it didn´t worked

gcloud builds submit --tag gcr.io/PROJECT-ID/dialogflow-PLATFORM
Deploy your integration to live using the following command. Replace PROJECT-ID with your agent’s GCP project Id, PLATFORM with the platform subdirectory name, and YOUR_KEY_FILE with the name (not path) of your Service Account JSON key file.

gcloud beta run deploy --image gcr.io/PROJECT-ID/dialogflow-PLATFORM --update-env-vars GOOGLE_APPLICATION_CREDENTIALS=YOUR_KEY_FILE --memory 1Gi

aaa

const authToken =8ad710f6c283b9af4d719c62ce343f01

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.