I am trying to figure out whether it is possible to send a response back to the user from my python flask app to twilio, which is integrated with dialogflow.
Using Twilio and python only, and using messaging response I can send images back to the user.
However, once I link the integration with dialogflow, I'm not sure what to pass back to dialogflow for it to recognise the image link.
Currently I am using fulfillment text to send text from python to Twilio/dialogflow.
Please help.
Thanks for your reply. I have managed to solve this issue. For others experiencing a similar issue, using Client.messages.create function, it allows you to attach a file, using the mediaUrl parameter.
Related
First post on here. Im working on an application in python using the twilio voice api. Id need to be able to create twiml xml data based on user messages. Hence twiml creation and hosting programmatically on the fly. Is there anyone here that can point me in the right direction. For all i know twilml bin doesnt allow that. Thank you
Twilio developer evangelist here.
You are right that TwiML Bins don't allow to generate dynamic responses (outside of some light templating). However, you are building with Python, so you can build a web application that responds to Twilio webhooks with dynamically generated TwiML.
I'd recommend working through this tutorial on receiving and responding to incoming SMS messages in Python to understand how the process works and how to use the Twilio Python library to generate dynamic TwiML.
As far as I know, this question hasn't really been asked.
I want to use twilio to send and receive messages from a python app. Sending isn't a problem, but I know receiving uses webhooks. Every tutorial and even the twilio documentation uses flask. Im wondering if I can create a program to receive information from twilio without using flask or is flask/django required.
Thanks
You need something that can accept HTTP requests
Webhooks are user-defined HTTP callbacks. They are usually triggered by some event, such as receiving an SMS message or an incoming phone call. When that event occurs, Twilio makes an HTTP request (usually a POST or a GET) to the URL configured for the webhook.
To handle a webhook, you only need to build a small web application that can accept the HTTP requests.
It needs to be something that Twilio can access through HTTP. So while you can probably use any web framework you want, you are going to need one.
https://www.twilio.com/docs/sms/tutorials/how-to-receive-and-reply-python
I'm developing an application with Dialogflow and Actions on Google which requires to send daily birthday notification in Google Assistant.
I'm following this documentation to send daily updates. But I'm having trouble because of the language barrier.
I'm developing backed in Python and using fulfillment to serve the request, but that documentation is in Node.js. So I need help to send daily updates.
I've done up to Console setup. Please guide me for further process.(Which JSON req. should I sent?)
If you look down that documentation page a bit here and click the JSON tab, you'll see the specific format you need to configure the subscription to your birthday updates.
Since you're not using a client library, you'll need to write the Python code yourself to respond with the appropriate JSON.
I am working on a project, where I want to be able to retrieve real-time updates if users upload a picture on Instagram with a specific tag (a custom action should be executed when a user uploads a picture with a specific tag). The whole thing should be written in Python and should be running on a stand-alone Raspberry Pi.
As far as I have understood the Python Instagram API sends a GET request to the specified callback url which needs to respond with the hub.challenge parameter and so on. This means that the Python Script needs to run on the Server that is also hosting the callback url right? Which would mean that I can not do this on a Raspberry Pi.
Am I missing something here? I also built a similar thing with the Twitter Streaming API and it was not a problem at all!
Thanks in advance!
If you successfully used twitter on raspberry (I did it also, with Twython, which was fun), you can just use ifttt to send a tweet automatically each time there's a new photo on instagram. With the raspberry, you can check for new tweets regularly.
I've managed to implement the simpleauth package for a basic webapp I've been working on. I now need to send data to this service from a python script running on a Raspberry Pi (the app is a "data logger" for temperature). Before I had implemented the simpleauth package, I could just POST the data and username to the site. Alas, now the response is the login page (to be expected).
If I wanted to connect to this webapp from the command line, I assume I'll need to authenticate myself. However, how would I go about doing this? I assume I'm going to need to programmatically replicate the steps taken by the browser to get a token but I think I've tried this and it hasn't worked. I'm not even sure who my token provider is - my webapp, or Google?
Any tips?
If you're trying to authenticate on an installed or console app, you need to use urn:ietf:wg:oauth:2.0:oob as the redirect_uri GET param in when you redirect the user to the login/authorization page. Once your app has been authorized, they'll be presented with a valid OAuth 2.0 code in a text box that they'll have to copy/paste into your app. Once they do that, then your app must follow the rest of the usual server-side flow (code for token exchange, etc.).