I am trying to send initial message from power virtual agents, but i don't have any idea how can i do this. I just want after install app when bot load it will send a message to team channel
To make your bot start the conversation, you’ll need to deploy a custom canvas that includes arguments that cause the default system greeting topic to be displayed when the bot loads. Please follow this documentation(https://powervirtualagents.microsoft.com/en-us/blog/make-your-power-virtual-agents-bot-start-the-conversation-using-a-custom-canvas/) which explains how to send proactive message via Power virtual agent.
You can also refer this: https://dhina.org/2020/03/30/building-proactive-bot-with-power-virtual-agents/
Related
For some security reasons that I can't have a public accessible server to receive data from slack.
So, this is what I'm planning to do:
Inbound message from slack: using RTM API
Outbound message to slack: using RTM API or Web API
Questions:
Any better alternatives?
Any restrictions? (AFAIK, buttons and drop downs can't work)
If Web API reach rate limit, can I use incoming webhook as a backup plan?
RTM only approach
Yes, that would work. With only the RTM API you are limited to:
receiving and responding to messages
Other RTM events.
You can't use any interactive functionality like:
Interactive components (buttons, menus, datepickers)
Dialogs
Rate limit on message posting
Using the webhook as "backup" to circumvent the rate limit is not an option, since the rate limit of posting max 1 message per second applies to all form of message posting.
From the documentation:
In general, apps may post no more than one message per second per
channel, whether a message is posted via chat.postMessage, an incoming
webhook, or one of the many other ways to send messages in to Slack.
Alternatives
You did not give any details about the reasons why your app can't expose an endpoint to the public Internet. But you might want to consider using a VPN tunnel like ngrok.
Yes! Socket Mode
There is a new alternative from slack, Socket Mode, which doesn't require a publicly accessible server.
Note: this is only for private apps.
With Socket Mode you have an API token and your server uses it to communicate with Slack's servers and create a two way socket connection. This means your Slack Bot's code can run on a machine behind a firewall and not require any inbound ports to be opened.
Slack message delivery requires an acknowledgement once you get the message, or else they may retry to deliver it.
Limitations
Socket Mode has two main limitations:
Apps using Socket Mode are not currently allowed in the public Slack App Directory.
Socket Mode is only available for apps using new, granular permissions. If you created your app on or after December of 2019, good news: your app already uses the new permissions. Otherwise, you may have to migrate your classic Slack app to use granular permissions before turning on Socket Mode.
I'm working on a simple slack bot which is supposed to ask simple questions (yes/no) and based on answers perform some actions. AFAIU I should be using interactive messages for this. The problem is that it's supposed that slack will then call some external URL with the result, but for security reasons, I can't expose any service externally.
I was hoping I can just receive some event (using Events API) from Slack that user choose one of the options and simply read it directly using API. Unfortunately I can't find anything like that.
Is possible to use interactive messages without exposing external service to the world?
Yes. If you build a bot with the Real Time Messaging API you do not need to expose an endpoint to the public Internet.
With the RTM API you open a connection to Slack (which can be from behind a firewall) and maintain that connection. There is no call-back from Slack.
However, the RTM API will only enable you to create a chat bot that can react to events and message posts. The interactive message features like buttons and drop-down menus still require you to provide an endpoint.
Common description
First, my goal is sending notifications from my service using an internal API to a MT channel and having an option to answer it transmitting one to internal API.
I've found a Connector has such functionality. Good example which i've tried to use StackOverflowConnector. It was a good point to start that is exactly what i need(Bot has inappropriate UI behaviour) , but i've decided to do it by small steps from creating a Bot just to understand things better. In short i had success, the bot and a mt channel communicted well both directions. Next point was Connector. I explored all information here:
https://learn.microsoft.com/en-us/microsoftteams/platform/index
https://learn.microsoft.com/en-us/azure/bot-service/?view=azure-bot-service-3.0
https://learn.microsoft.com/en-us/outlook/
What i have taken to create a Connector
registered a Connector in the Connectors Developer Dashboard with followed fields:
Connector name: connector
Logo: contoso96x96.png
Short description of your app (10 words or less): sd
Detailed description of what your Connector does (3-5 sentences): dd
Company website: https://external.service
List the events supported by your Connector: all
Do you want to enable actions on your Connector cards?: Yes
Actions URL: https://external.service/api/messages
Does your service support login using subdomain?: No
Landing page for your users for Inbox: https://external.service
Landing page for your users for Groups or Teams: https://external.service
Redirect URLs: https://external.service/api/messages
Ran the external service to communicate with a Connector. Checked service works
took a manifest.json file is generated by Connectors Developer Dashboard and uploaded it to a Microsoft Team(MT) team. Uploading was successful. There was no network requests(monitored nginx logs) to the external service
selected a channel in MT and clicked the Connectors dialog option. Found the created connector in the list Sideloaded group and clicked Configure. Got such window and clicked Done. Nothing happened
ran nodejs code from the [github connector example][3](it didn't have meaning because of total lack of the requests)
What i expected:
Any activity in the external service, other nodes of integration i can't monitor. I compare this failed result with ones of StackOverflowConnector and my bot experience, both works as needed.
Question:
How to set up the connector to work, to send network requests? At least to have echo logic.
Upd:
I have noticed a weird report of deleting a MT app of the connector.
I believe you might have some confusion between a Bot and a Connector. Based on your post description you should be looking to create a Bot and not a Connector. Please let us know if you have further queries.
Update:
Could you please give a try with C# sample code? Here is the basic flow for your understanding:
When user clicks on Visit Site to install the Setup endpoint is hit.
When user clicks on Connecto to Office 365 the Register endpoint is hit with webhook information.
When new task is created in your system you can post the message to registered channels using webhook url.
I'm trying to come up with a solution to this situation:
Imagine you are in an area and you do not have any cell phone service but you do have Wifi.
The ask is to have a user that only has data to be able to text a number (via iMessage) and get a confirmation code in return.
The first tool I thought would be necessary for this would be Twilio - but it seems like Twilio only sends over standard SMS.
Are there any other tools out there anyone have used that would work in this idea? Something similar to Twilio but only ran on data?
Twilio developer evangelist here.
This is something you can only do as the phone provider or network provider (using Three in the UK allows me to make phone calls over wifi with no phone signal, for example).
The two things you can do is either build yourself a native application that you can send messages to using push notifications or send messages to existing native apps, like Messenger, Viber or Line.
I have a client who sends about 5000 SMS messages each month. They are currently doing this from an iPhone, by actually typing the message in to the phone. (I think the messages are quite repetitive, and are often addressed to groups).
The reason that they are not using an online message gateway is purely the cost. We can use a gateway here in Australia (such as Amazon SMS) for about 7.5 cents for transactional (and 2.5 cents for promotional, though I don't know if this is reliable enough).
When the client uses their own iPhone, the SMS is included in their plan, and costs them nothing extra.
I am building a web-based application for the client and the question is 'Can I send SMS via a handset connected to the client's desktop PC'. I think the answer is no, but would like to be surprised. The application is responsive, so what about if they triggered the messages from a browser on the phone? Still no?
If you could use an Android phone instead an iPhone, you could create a small gateway app on the Android that can send text messages without the need for the user's intervention.
It could work like this:
The Android app would have a simple REST interface, a good start could be https://github.com/NanoHttpd/nanohttpd.
An endpoint in the Android app could send messages, see Sending SMS programmatically without opening message app
The software on the computer would use the rest endpoint on the Android phone to send the message.
This wouldn't work on the iPhone because it doesn't allow an app to send a text message without the user's intervention.