Dialogflow - Can't save response with only media content - dialogflow-es

I want to set up a response which plays an mp3 file in response to invocation.
The only way I managed to get this to work is of I add a simple response and suggestion_chips.
When I try to save only the media content I get an error "Errors in 'Default Welcome Intent' intent: Google Assistant simple_response, suggestion_chips should be added to intent".
What is the correct way to set up a response that will play an mp3 file without a text response and suggestion_chips?
This does not work:
This works:

A MediaResponse must also have a simple text response or SSML response associated with it.

Related

I am sending attachments in the messages but the messages.attachements isn't showing any attachments in my discord js bot

This is the code for messageCreate event that I wrote:
And in the discord app I am getting the response of the console log for no attachments even though I have tried sending images text and audio files:
You're most likely missing the MESSAGE_CONTENT intent.
Go to https://discord.com/developers/applications/ and enable the Message Content Intent in the Bot section.
Image for reference: https://i.imgur.com/mi8XMZb.jpg
Also make sure to add the GatewayIntentBits.MessageContent when you define your client.

Error 400 Invalid request with upload url but file is properly send to sharepoint

I try to send a file to sharepoint using the Microsoft Graph API resumable file upload :
First, I create my upload session POST: https://graph.microsoft.com/v1.0/me/drive/root:/{itemid}/createUploadSession and I get my upload url, no problem here.
I call my upload url PUT: https://xxx-my.sharepoint.com/personal/xxx_onmicrosoft_com/_api/v2.0/drive/items/xxxxxxxxxx/uploadSession?guid='xxxx'&overwrite=True&rename=False&dc=0&tempauth=xxx with some parameters: Content-Length and Content-Range
I get this error, code 400 : {"error":{"code":"invalidRequest","message":"Invalid request"}} but if I take a look to my sharepoint, the upload did create it! I tried to add or remove parameters, change PUT to POST but of course, it's not working (got DeferCommit was set to false for this upload session., which seems to be normal if I call the upload url with POST).
If I look to the error message, I just have Bad Request with no more informations. I don't know what I'm doing wrong or what I'm missing. If you have some insights, please do tell!!
I found what was missing! I need to add this header to my request: Accept with the value application/json. Now it works like a charm!

Downloading attachment from card at Trello Python3

I've got a problem that unables me to download attachment.
Via API I can Upload file as attachment, but instead of authorising via Oauth, I can get attachment, by it's ID, i got accept, but I cannot in response got any answer.
The way I do:
response = requests.get(f'https://api.trello.com/1/{card_id}/attachments/{id_of_attachment}', header, allow_redirects=True, auth=self.o_oauth)
header is dictionary which is:
empty,
or authorisation,
or authorisation and "fields": url_of_attachment
On every of this questions to Trelo I got access, and 200 Response. But in response there was no place where I could find my file (I'm uploading this in the same test, and I got accept).
Where, and how should I look for content?

How to use Twilio to send customized PDF’s from Google Drive/Sheets

I am having problems trying to send customized PDFs from Google Drive to users on WhatsApp using Twilio’s API.
I am using node.js and the documents are created in Google Sheets and stored in Google Drive.
client.messages
.create({
mediaUrl:['https://drive.google.com/uc?id=INSERT_FILE_ID&export=download'],
from: 'whatsapp:+14155238886',
body: `It's taco time!`,
to: 'whatsapp:+15017122661'
})
.then(message => console.log(message.sid));
I thought it would be possible to send the PDF by passing the PDF’s Drive link through MediaURL as that is what is recommended on Twilio’s site for sending media (Images, .mp3’s and PDF’s) but when I try that it doesn’t work.
NB: it works when I try image URL’s etc.
I have tried sending the webContentLink of the PDF that also doesn’t work.
example: how the pdf should look when sent
I do not want to send the user a normal link for them to leave WhatsApp.
Any help with this or any other method to achieve this would be greatly appreciated.
Twilio will check the content-type of the file which you have been passing in the mediaUrl parameter. Twilio will reject if the content-type headers of your media attachment do not match the file extension (for example, content-type is image/jpg but the file extension is .png). It specified in the following links specifies:
Twilio Troubleshooting
Twilio supported-mime-types

MS Bot Framework - Messages with audio attachments lost

I'm writing a bot in Node.js using the MS Bot Framework. To send attachments, I'm actually using the filestream buffer as the contentUrl, e.g.
...
var base64 = new Buffer(filedata).toString('base64');
var msg = new builder.Message()
.setText(session, text)
.addAttachment({
contentUrl: util.format('data:%s;base64,%s', contentType, base64),
contentType: contentType
});
session.send(msg);
...
where contentType is the proper mimetype for the file in question.
When I test this locally (using the Bot Framework Emulator), this works perfectly for both image and audio files - messages with image attachments display the image, and messages with audio attachments show the audiocard allowing for playback, etc.
However, when I test this through FB Messenger, the images work fine, but the audio messages just never appear in FB. Not even the text of the message comes through; it's like the entire message is lost. The dialogue simply skips over the message containing the audio attachment. I'm not even seeing any errors received server-side.
This is happening with both mp3 and wav test audio files, that are each under 1MB (smaller than many of the image files I've successfully tested).
Is there some trick to sending playable audio files to the FB Messenger channel specifically?
Thanks!
I wasn't (yet) able to get a response from FB support, but after further testing, it looks like there is a filesize limit on audio files FB Messenger will accept.
Specifically, I was able to get a sample file of ~45KB to send and display in Messenger successfully, but a larger file of ~400KB got dropped (aka seemed to send successfully from the server-side perspective, but did not show up in Messenger).
Strangely, some of my much larger image files went through, so it seems like this same limit does not exist for image attachments.
Will do some further testing, but it seems like the ultimate solution will be either to majorly compress my audio files, or to host them somewhere else instead of sending as a filestream.

Resources