I am creating a message to send to user from bot. The type is data and size is at about 1mb. When I am using bot emulator the message works, but when I publish my bot the message doesn't work. The Badrequest error is returned.
My question is: Is it possible to send messages over 300kb from bot to user?
Thank you so much for your attention.
There is no set size limit within the bot framework itself as this is dependent on the channels. You will have to refer to the respective channel API documentation to know about the message size limits.
The documentation on message length for Microsoft Teams can be found here.
For the Direct Line channel, he total size of the activity, when serialized to JSON, must not exceed 300K characters.The file size limit or the attachment limit is 4MB.
For Facebook Messenger,the text message must be UTF-8 and has a 2000 character limit.
Related
I'm working on a project where I want to live display users' points whenever the gain or lose points.
I have an api that sends event to the frontend:
public function test(Request $request){
$message = $request->message;
$users = User::all()->where('company_id', $message);
event(new MyEvent([$users]));
}
Whenever the api is called, I recieve the following error:
Illuminate\Broadcasting\BroadcastException: Pusher error: The data content of this event exceeds the allowed maximum (10240 bytes).
How can this be solved?
The simple answer is to reduce the payload size - Pusher has a size limit on the body of an event - https://pusher.com/docs/channels/library_auth_reference/rest-api/#post-event-trigger-an-event
They also list some strategies for reducing payload size, such as:
sending multiple small events instead one one large event (chunking)
using compression to reduce payload size
sending a link the client that downloads the content instead of transmitting it via Channels.
See https://support.pusher.com/hc/en-us/articles/4412243423761-What-Is-The-Message-Size-Limit-When-Publishing-an-Event-in-Channels- for more info
Source: https://support.pusher.com/hc/en-us/articles/4412243423761-What-Is-The-Message-Size-Limit-When-Publishing-an-Event-in-Channels-
The message size limit is 10KB.
There are several approaches to work around this limit:
Chunking. One approach is to split your large message into smaller
chunks before publishing, then recombine them on receipt. This
repository shows an example of a chunking protocol: https://github.com/pusher/pusher-channels-chunking-example.
Linking. Instead of sending a large message via Pusher Channels, you could store that message elsewhere, and just send your clients send a link to that content.
Compression, e.g.
Compression algorithms like gzip.
Removing unnecessary characters. Whitespace is one example.
Removing/shortening keys. Instead of {"user":"jim","email":"jim#example.com"}, you could use {"u":"jim","e":"jim#example.com"}, or ["jim","jim#example.com"].
A dedicated cluster. If none of the above are suitable and you really need to sender larger single messages, we can set up a dedicated cluster. If you are interested in provisioning a dedicated cluster as part of an enterprise package please contact Pusher sales.
Is it possible to find the last activity on a conversation, using Microsoft Bot.
https://directline.botframework.com/v3/directline/conversations/esxgfvjbkmkmljbjh-d/activities?watermark=10
I need to send a paginated response to the client for a conversation. Using a watermark, it will allow me to get all the activities after a certain watermark value. But this will not help in finding the activities in a watermark range. And moreover, how to identify, what should be the initial watermark value?
The temporary cache of messages in the Direct Line channel is not intended to be a persistent store, but only as a connection reliability mechanism. If you need to retrieve conversation activities at a later time, you should be using a Transcript Store and the SendConversationHistoryAsync api as demonstrated in this sample: https://github.com/Microsoft/BotBuilder-Samples/blob/master/samples/csharp_dotnetcore/22.conversation-history/
As indicated in the documentation about DirectLine here, currently the only way to get the latest activity is by requesting several times by changing the watermark value:
Clients should page through the available activities by advancing the
watermark value until no activities are returned.
i am trying to use the API to get the total number of messages posted by each user during a certain period. Ideally, I would be able to break the number of messages by the type of channel (public, private, direct messages.) Is this possible? I am looking through the API documentation but haven't found anything. I would be using it to create a script that would automatically generate weekly activity reports.
Thank you for any advice you can provide!
There is no special endpoint for this information as far as I know, but you can generate something similar yourself by looping though all channels and counting the message per user, e.g.
Get list of all channels with conversations.list
Get history of each channel with conversations.history
Count messages per user
Of course your results would not include message from channels, that your bot has no access too (e.g. some private channels, direct message channels).
I use Twilio with my team management system. A text message is automatically sent out for each game. The receiver can then reply with YES or NO. My issue is that when I send two text messages, I have no way to tell if the reply is for the first message I sent, or the second.
Does Twilio have any way to determine which text message it was a response to?
Twilio developer evangelist here.
If you are sending two messages from one Twilio number to the same user number there is nothing within the SMS specification that allows a user to reply to a specific message, so there is nothing you can do with Twilio to detect that.
If you are sending two messages to two different numbers and you get replies from those numbers, you can match against the from number and see what the last message sent from that number was and attach the reply to that.
Alternatively, if you want to get replies from one user to different messages, you could send them from different Twilio numbers. That way you can match the outgoing number to the message and the answer. This is mostly used for phone number masking to enable anonymous communications and there is a good tutorial available on this in the Twilio documentation.
Let me know if that helps at all.
I am looking to build an IM app using the Sinch SDK, but wanted to know what the max number of characters that I can send in a message is? Can't see that in the documentation.
There isn’t a fixed limit to how many characters can be included in a message. Messages will be split into multiple if size is too large, however we discourage from sending very large messages such as encoding images into headers…