Twilio MMS Send Local File - salesforce

We can send MMS using Twilio api in Salesforce.
As i know that using that code i can send MMS using Twilio in Salesforce.
Sending a MMS
properties.add(new TwilioNameValuePair('MediaUrl','https://www.twilio.com/packages/company/img/logos_downloadable_round.png'));
But it's seams that we have need to pass media file url.
But how can we take a input of file form Local machine and send them using Twilio MMS?

You can use twilio assets for sending local files.
- First you need to upload the local files on twilio assets.
- use the assets url and media url for sending Mms

Rajendra, hello! Megan from Twilio here.
This sounds similar to what I ran into building an OpenCV MMS implementation in this blog post.
The example there is in Python specifically, after writing an image to my local filesystem and making the desired modifications on it, I send it through:
#app.route('/uploads/<filename>', methods=['GET', 'POST'])
def uploaded_file(filename):
return send_from_directory(UPLOAD_FOLDER,
filename)
which handles the delivery of the following TwiML:
message.media('http://YourNgrokURL/uploads/{}'.format(filename))
You'll be needing the equivalent of Flask's send_from_directory to handle this in your implementation.
Hope this helps!

Related

using /upload urls with Google API client

Consider this:
I am fetching rawbody messages by this call:
service.users().messages().get(userId='me', format='raw', id=msgid)
Then I am pushing rawbody messages by this Call:
service.users().messages().insert(userId='me', body=message)
Now when the mails contain attachments bigger 5MB, I encounter 413 "Request Entity Too Large.", and I can't push mails.
GMail API messages.insert Documentation advices to use
POST https://www.googleapis.com/upload/gmail/v1/users/userId/messages
instead of
POST https://www.googleapis.com/gmail/v1/users/userId/messages.
But Google API Client doesn't seem to have any documentation about how to call the above Url, and it keeps getting back to latter url.
How Can send post requests to first url(with /upload) with Google Api Client rather than its default?
How to use /upload url and set uploadType=multipart with Google APi Client?
Yeah, this was totally unclear from the documentation for the Google Python API client, but I found the solution in this other answer. It turns out that you use the same method (users().messages().insert()) but you pass media_body instead of body['raw']. Something like this should work:
from io import BytesIO
from base64 import urlsafe_b64decode
import googleapiclient.http
b = BytesIO()
message_bytes = urlsafe_b64decode(fetched_message['raw'])
b.write(message_bytes)
media_body = googleapiclient.http.MediaIoBaseUpload(b, mimetype='message/rfc822')
service.users().messages().insert(userId='me', media_body=media_body).execute()
I haven't tried using uploadType=multipart, but maybe you can figure it out from this documentation page and looking at the contents of the googleapiclient.http module.

Angular Instagram endpoint embed issue

I have a sample Angular app that fetches all content from a user through an endpoint, without the use of calling hashtags. I can get the retrieve photos with a given hashtag example to work, but I would rather just get the entire feed of a user.This is the working content link for the sample:
var endPoint = "https://api.instagram.com/v1/media/popular?client_id=642176ece1e7445e99244cec26f4de1f&callback=JSON_CALLBACK";
I registered my new app, have the client ID and client secret, and I'm just trying to embed the entire user feed into a page.
While looking through https://instagram.com/developer/endpoints/ I can't seem to find a link that works with a client ID and Client Secret.
Any help is appreciated.
There is never going to be a "link" that works with your client secret. The client secret is to be used with a back-end programming language using the instagram SDK. If you passed your client secret through a simple URL or front-end programming language, it wouldn't be secret anymore ;).
Some example SDK's / libraries:
Node: https://github.com/totemstech/instagram-node
Python: https://github.com/Instagram/python-instagram
Ruby: https://github.com/Instagram/instagram-ruby-gem
If you don't want to use a back-end language, you'll need to get a token and use that in your links. More info on tokens here: https://instagram.com/developer/authentication/?hl=en

SSL Post Request to Appengine

I need to develop a web-based service on Google Appengine (Python 2.7) that involves the sending of sensitive data from a third-party website over to my site (preferably through SSL). Say that my url is https://example.appspot.com, and I want the third-party site http://example.com to send two values through a POST request, one is username and the other is password, to https://example.appspot.com/receiverhandler. This receiver handler is class ReceiverHandler(webapp2.RequestHandler). My question is basically: how can I send this POST data through an SSL connection? I'm not entirely familiar with the SSL protocol, so I have no idea where to begin.
Using urlfetch, just send it to the SSL-secured url: https://example.appspot.com/receiverhandler
This gives great explanation of how to do it, using POST params (payload):
https://developers.google.com/appengine/docs/python/urlfetch/

Upload file via Channel API

I read the article which talk about Blobstore (https://developers.google.com/appengine/docs/go/blobstore/).
I would to know if I can use Channel API to send a file, and if it's possible, how.
The Channel API is designed to send text. So instead of sending a file via the Channel API, you would send a pointer to the file for the client to download. The pointer may be a datastore key, a blobstore key, a URL etc - depends on your backend really.

Sending Image/File/Audio Files to Browser via websockets/http using mongoose

I am using Mongoose library to have a localhost server run in my system.
Now, through HTTP Connection OR Websocket Connection, I want to send files/documents/images/small audio files to the client who is making request to the local host.
Until now i was sending a simple json message via websockets and xml data via http connection to client (Browser) by using these Mongoose APIs
mg_send_data()
mg_websocket_write()
Since Mongoose is being used the whole implementation is in C
Kindly let me know if I can refer to any of the example code if there are any, OR any API documentation of Mongoose which would help me to achieve the above.
Looking forward for valuable responses.
From the github repository you will find :
the API documentation
severals samples that show how to implement websocket and sending MJPEG

Resources