Are there any ways to pre-fill the SMS message body by using web activities?
My application is not certified and I cannot use websms api to send messages.
The property you are looking for is probably the body property on the mozActivity options object. Here is the code from the bugzilla bug 852224 in which this feature was implemented:
new MozActivity({
name: 'new',
data: {
type: 'websms/sms',
number: '999',
body: 'hi!'
}
});
Please note, that I tried this code on latest stock firmware of the Keon Firefox OS developer phone, but it doesn't seem to work for the body - that might be because this firmware version (1.0.1.0, build id.:20130712192650) might doesn't yet include this fix.
Related
I have chat bot, I build it with bot framework nodejs SDK I integrate this chat bot to whatsapp and I want to display some buttons in the whatsapp chat,
So is there any one found a solution for this problem pleas help me
Note: I try to send a hero card but I run to problem
Error: TwilioWhatsAppAdapter.parseActivity():
An activity text or attachment with contentUrl must be specified.
I don't know how bot framework attempts to send WhatsApp messages with buttons, but I doubt it fits with the way Twilio wants to send them.
Currently, to send a message with buttons, you need to register and use a template message. When you send the text of a message that matches one of your templates, then Twilio will deliver the entire template with buttons as well.
For the future, look out for the Twilio Content API which will streamline templates, buttons and other rich messages across platforms.
It looks like you are using the TwilioWhatsAppAdapter from the botbuilder-community-js repo.
Looking at the adapter's code, it doesn't appear to be configured to handle any card other than a 'signin' card (see here). If you don't mind doing a little leg work on this, I don't see why you couldn't fork this repo and build in functionality that supports a hero card similar to the signin implementation.
I imagine it would look something like this:
case 'application/vnd.microsoft.card.hero':
// eslint-disable-next-line no-case-declarations
const hero = attachment.content;
message.body = `${ hero.text }\n\n`;
message.body += (hero.buttons[0].title ? `*${ hero.buttons[0].title }*\n` : '');
message.body += hero.buttons[0].value;
break;
The above may need a little massaging but it wouldn't be far off from this. Then, you just need to build the library for use.
Adaptive cards for bots in MS Teams now appear to be displaying a confirmation of "your response was sent to the app" message when a button on the card is clicked.
Is there a way to turn this notification off?
This is by design, and cannot be disabled.
In a MS Teams if you have your message formatted as Adaptive Card you have different kind of buttons (Actions),
Some of them are resulting with "Your response was sent to the app" some of them not.
We had same issue and found out that if you are using type Action.Submit - it will show this notification, but if you use Action.Execute, it will not.
...
{
type: 'Action.Execute',
title: 'My Button',
data: {
msteams: {
type: 'task/submit',
},
somePayload: '<data>',
},
},
....
Hope it'll be helpful to someone stumbled upon the same issue.
I've been trying to test a function app sending an activity to a bot that has an existing conversation, but to simplify for this post, I'll speak in terms of sending it via postman. I've have been butting up against an issue wherein the conversationId is not being found, despite confirming it does exist beforehand and I'm not entirely sure what I've done wrong.
I log onto portal azure, and go to my bot to Test in Web Chat. I authenticate the bot, and the conversation starts.
Here, I've checked the conversationId is exactly what I expect to be by examining the conversation calls response in Chromes debug tools, in this case it is 1GJ0N9UYKGyELu3LqpDF6b-a
Here is the exact conversation response...
conversationId: "1GJ0N9UYKGyELu3LqpDF6b-a"
expires_in: 3600
referenceGrammarId: "fcab5fbf-67c7-bf55-934a-274e525c78a9"
streamUrl: "wss://webchat.botframework.com/v3/directline/conversations/1GJ0N9UYKGyELu3LqpDF6b-a/stream?watermark=-&t=ew0KICAi...."
token: "ew0KICA..."
So from here, in my mind I should be able to do the following in postman
POST https://webchat.botframework.com/v3/directline/conversations/1GJ0N9UYKGyELu3LqpDF6b-a/activities
Content-Type: application/json
Authorization: Bearer {My webchats channels secret code}
Body:
{
"type": "message",
"from": {
"name": "foo"
},
"text": "bar"
}
I'd expect a 200OK and the message 'bar' to appear in my Test In Web Chat from 'foo', but it does not. Instead I get an error in postman stating:
{
"error": {
"code": "BadArgument",
"message": "Conversation not found"
}
}
How exactly can this be? If I've just created that conversation and can demonstrate that conversationId is in use, why is the post message saying it can't be found? Am I incorrectly using channels? Or doing something blindingly obvious here?
So to answer my own question, to make a long story short. It looks like the example activity supplied in the Microsoft documentation doesn't quite cut it. There is something else that is required, although I didn't have time to narrow it down.
The solution I took, as I was running low on time was to write a method to save an activity to cosmosDb as part of the authentication flow. This way I have an ironclad activity that I know has worked in at least the invoke stages of the dialog, and I know a conversation reference is correct and present. From there I pulled the activity and changed 4 fields in it.
activity.Type = "message",
activity.From = new From { Id = "{BotId}", Name = "Gilbert Bottfried", Role = "bot },
activity.Text = "{My message}",
activity.Subject = "{my message subject}"
From there, it was essentially a case of just creating a connector client and firing off this repurposed activity.
AppCredentials.TrustServiceUrl(serviceUrl, DateTime.MaxValue);
ConnectorClient client = new ConnectorClient(
new Uri(serviceUrl),
MicrosoftAppId,
MicrosoftAppPassword);
await client.Conversations.SendToConversationAsync(activity.Conversation.Id, activity);
It seems that this was enough to get it working, and it makes for a nice referenceable conversation Id for future messages. Although I found other issues with working with WebChat, because I suspect it's not entirely stable sending messages to and throw via websockets. The testing experience was much more stable on msteams itself, it seemed to handle my barrage of test messages like a champ.
This is essentially a bruteforce method, as I'm storing and sending a lot of unnecessary data, but it works. I may append this answer to trim down what I find to be necessary in the future, but that will require testing.
I'm developing an app that can receive push notifications. In my nodejs serve sourcecode, I create a notification thanks to the 'firebase-admin' library. I use ionic/cordova-phonegap-plugin-push for the reception of said notifications.
I also managed to make the notifications stack themselves like Gmail notifications, or Discord notifications, etc... (ONE notification containing MULTIPLE notifications) using the 'style':'inbox' and 'summaryText' properties. Here is the message object I create in the backend nodejs server :
const admin = require('firebase-admin');
let message = {
token: user.deviceId,
data: {
title: notification.title,
body: status,
style: 'inbox',
summaryText: 'You have %n% new notifications',
contentAvailable: 'true',
type, // custom data I need
targetId // custom data I need
},
android: { // android configuration
priority
},
apns: { // ios configuration
headers: {
apnsPriority
}
}
}
console.log("message", message);
admin.messaging().send(message)...
My first issue was that if the app is either killed or in the background, when you open it, with or without taping the stacked notifications, I only get the last notification received in the push.on('notification') phonegap event...
If there's a way to get ALL stacked notifications, I'm all ears, cause it don't seem like it's possible...
That's why I have another issue : as I can't get all notifications data, I would like to set a priority so that when I tap on the stacked notifications, I get the datas from the notification with the HIGHEST priority...
As you can see I've set priority variables for both Android and iOS but it doesn't seem to work... I'm only testing on Android right now.
I've asked my dear friend Google for the past 4hours without finding the answer...
Is there a solution to this kind of issue ?
Thanks in advance for your help :)
I'm using googleapis npm package ("apis/drive/v3.js") for Google Drive service. On backend I'm using NodeJS and ngrok for local testing. My problem is that I can't get notifications.
The following code:
drive.changes.watch({
pageToken: startPageToken,
resource: {
id: uuid.v1(),
type: 'web_hook',
address: 'https://7def94f6.ngrok.io/notifications'
}
}, function(err, result) {
console.log(result)
});
returns some like:
{
kind: 'api#channel',
id: '8c9d74f0-fe7b-11e5-a764-fd0d7465593e',
resourceId: '9amJTbMCYabCkFvn8ssPrtzWvAM',
resourceUri: 'https://www.googleapis.com/drive/v3/changes?includeRemoved=true&pageSize=100&pageToken=6051&restrictToMyDrive=false&spaces=drive&alt=json',
expiration: '1460227829000'
}
When I try to change any files in Google Drive, the notifications do not comes. Dear colleges, what is wrong?
This should be a comment but i do not have enough (50points) experience to post one. Sorry if this is not a real answer but might help.
I learned this today. I'm doing practically the same thing like you - only not with Drive but Gmail api.
I see you have this error:
"push.webhookUrlUnauthorized", "message": "Unauthorized WebHook etc..."
I think this is because one of the 2 reasons:
you didn't give the Drive-api publisher permissions to your topic.
Second if you want to receive notifications, the authorized webHooks Url must be set both on the server( your project) and in your pub/sub service(Google Cloud).
See below - for me this setup works:
1. Create a topic
2. Give the Drive publish permissions to your topic. This is done by adding the Drive scope in the box and following steps 2 and 3.
3. Configure authorized WebHooks. Form the Create Topic page - click on add subscriptions. Not rely vizible here but once you are there you can manage.