Comments (7)
I've already tested the dialogflow-integration with Twitter's direct message. I found out, that when you deploy dialogflow-integration to Cloud Run, there is a chance, that it will not work! That is, because your dialogflow-integration on Cloud Run fail the Twitter's specification for webhook (Webhook must respond back to Twitter request within 3 seconds).
Here's what happens when you deploy dialogflow-integration to Cloud Run:
- dialogflow-integration sends a POST request to Twitter API to delete any subscriptions on your Twitter Account
- dialogflow-integration sends a POST request to Twitter API to delete any registered webhooks on your Twitter Account
- dialogflow-integration sends a POST request to Twitter API to register a new webhook url (the webhook url specified in
targetUrl
variable) to your Twitter app
3.1 Twitter sends a GET request to your dialogflow-integration to make sure that your web app supports POST requests for incoming events
3.2 If your dialogflow-integration responds Twitter request within 3 seconds, your webhook url will be registered. **If not, the webhook will not be registered (this might be the reason why your dialogflow-integration did not work!) - dialogflow-integration sends a POST request to Twitter API to register a subscription to your Twitter app --> If (3) fails, this will fail as well.
In order to solve your issue, I suggest you to:
- Replace
registerWebhook
function in/twitter/server.js
with the following code
function registerWebhook() {
return new Promise((resolve, reject) => {
request.post('https://api.twitter.com/1.1/account_activity/all/'+
environmentName+'/webhooks.json',{
oauth:twitterOAuth,
form:{
url:targetUrl
}
}, function(err, resp, body){
if (err) {
console.error('Failed to register webhook: ' + err);
reject();
} else {
// to check the webhook registration result from Cloud Run console
console.log("register webhook: ", JSON.stringify(resp.body))
resolve();
}
});
});
}
Note: This code has the same function as the original registerWebhook
, except it will also print the response from the Twitter to Cloud Run log.
-
Re-deploy your dialogflow-integration to Cloud Run
-
Check the log console. If you see the following message, try to re-deploy your dialogflow-integration again!
register webhook: "{\"errors\":[{\"code\":214,\"message\":\"High latency on CRC GET request. Your webhook should respond in less than 3 seconds.\"}]}"
Hope this solves your problem!
from dialogflow-integrations.
@mekpavit Thanks for the help. I added the log as you suggested and it shows the below error message:
register webhook: "{"errors":[{"code":214,"message":"Too many resources already created."}]}"
from dialogflow-integrations.
@JyothishG Instead of using URL from ngrok, you can just use http://127.0.01:5000/ as a callback URL.
Try this one
-
Add these 2 callback URL to your Twitter app
http://127.0.0.1:5000/callbacks/addsub
http://127.0.0.1:5000/callbacks/removesub -
Access your local dashboard using http://127.0.0.1:5000/
-
Try adding/removing subscription and webhook
from dialogflow-integrations.
I am now trying to reproduce your issue. If there is any progress, I will tell you here!
from dialogflow-integrations.
@JyothishG I suggest you to use the Twitter Activity Dashboard to see all the webhook registered to your account. I guess that maybe you have too many active webhook/subscription on your Twitter Dev account. I'm not sure because I don't get used to Twitter API that much. But I think you should try to register the webhook and subscription to the dashboard instead, so we can make sure that the problem doesn't come from dialogflow-integration source code.
So, could you please try to register the webhook/subscription directly via the dashboard and share the upcoming result?
from dialogflow-integrations.
@mekpavit When I tried to deploy the twitter activity dashboard application to Heroku like the instructions, it fails to launch the application. I'm always getting this error in the Heroku logs:
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
When tried in the local environment, it runs but the second step in "Configure webhook to receive events" fails (ie, Add a user subscription). It says:
Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings
I'm using ngrok to tunnel the requests and added the callback URLs to the application settings on the twitter developer page.
I'm really stuck here.
from dialogflow-integrations.
I was able to register webhook url using Twitter Activity Dashboard - I also got several errors (high latency, too many resources) but after several attempts it was registered. In the next step it needs to be validated. I have disabled Twitter integration in Dialogflow and now it works through deployed container. Thanks!
from dialogflow-integrations.
Related Issues (20)
- hii
- Problem with my Agent when Integrated with Twilio for WhatsApp HOT 1
- not able to edit, says I need a branch
- Sometimes , twitter integration becomes to be disconnected
- Want an option to always show SendIcon in Dialogflow Messanger.
- server.js
- CX and Twilio SMS? HOT 1
- account id
- Error
- Pass Phone Info
- How can we use facebook integration for managing multiple page with one agent?
- Getting error while trying to deploy GCP function
- [FR] Officially allow facebook persona in dialogflow (or at least mention in document about facebook persona)
- [bug] Dialogflow facebook integration not response with customer_feedback payload
- Azure-Dialogflow CX Integration-Webchat Issue-GatewayTimeout HOT 3
- MS teams-DF CX Integration- Enable Calling
- Security considerations HOT 1
- Twitter integration
- In a chatbot conversation using dialogflow cx, Is there a way to make the bot speak first? HOT 2
- Integrating Dialogflow CX with Azure Bot Service HOT 1
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 dialogflow-integrations.