How to store configuration items in a Slack App - node.js

How do you store permanent data in a Slack Application?
For example, the Opsidian slack app has a command to add your AWS keys. Where does it store those keys and how does it know to use specific keys for specific teams?
Is this on the Opsidian side? If that's the case does it just use the team.info endpoint and use that every command to match it up?
I have searched their documentation and Google with no luck.

A slack app usually consists of program code (e.g. PHP) and a database (e.g. MySQL) that runs on a server and interfaces with Slack through one of the APIs. All Slack team specific information is stored in a custom datadase using the unique team ID as key. The server needs to be accessible from the Internet, so that Slack can communicate with it. The server to run the program code of the app and the custom database for the app is not provided by Slack, but needs to be setup and maintained by the Slack app developer.
Slack itself only stores the basic configuration for an app (everything you see under "Your apps", e.g. Validation token) and some basic configuration per team after installation (e.g. That an app is installed and who installed it). Any other application specific information has to be stored by the app itself in its database.
The Slack app developer also needs to provide a custom website to allow installation of a Slack app for a team. See this answer for more info about the installation process and how to obtain a team specific access token.

Related

How to use Connect Services for event notifications in REST API with PHP SDK?

Helpers, I want to use Connect services with my DocuSign rest APIs integrated website. Could anyone help me out, Where can I get these in the GitHub? Basically the need is:
Once the document is fully executed, it will be routed via DocuSign connect to a folder which aligns with the name of the employee. This will require work on both the elected system as well as the DocuSign API to configure.
No problemo! These days, I suggest using an intermediate PaaS to queue and deliver the webhook notifications to your application which can live safely behind your firewall.
Here's a blog post on the technique. Note that we have PHP example software for this technique.
Once your PHP app is notified that an envelope is complete (fully signed), just download the documents from DocuSign and store them in your file system. Easy Peasy!

Testing bot application in Azure not responding

I’m using Azure Enterprise subscription and created a chat bot using same. But currently, I’m having trouble chatting using it. The bot is created using Visual studio using Bot framework and published to Azure. https://pihitsupportbot001.azurewebsites.net/ is my messaging end-point URL. I made bot channel registration for the same application and used the bot api endpoint with api/messages as end-point for it. Updated web config file with generated app ID and password and published. But when I try testing with web chat in Azure it is throwing ‘couldn’t send retry’. What would be the reason?
Jobin,
I was able to connect the bot emulator from my local pc to your endpoint, https://pihitsupportbot001.azurewebsites.net/api/message without, obviously, your appid and app password. I sent a 'hello' and received a sign-in card response. So, the bot appears to be working fine. Maybe the app service was still restarting after you edited the web.config?
Also, It's very hard to help diagnose these kinds of problems with limited information.
The error was due to the reason In global.asax I didn't have any state specified to store the conversation history. Earlier Microsoft had been providing a default state service for bots built using either the Node.js or .NET SDK’s. The state service is used to store and retrieve user and conversation data within the context of a conversation. But in fact in local while running using emulator or even in IIS, it doesn't need to have it. below is the documentation.
Bot State Service will soon be retired on March 31st, 2018
var store = new TableBotDataStore(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
Conversation.UpdateContainer(
builder =>
{
builder.Register(c => store)
.Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
.AsSelf()
.SingleInstance();
builder.Register(c => new CachingBotDataStore(store,
CachingBotDataStoreConsistencyPolicy
.ETagBasedConsistency))
.As<IBotDataStore<BotData>>()
.AsSelf()
.InstancePerLifetimeScope();
});

Customise Azure bot framework in NodeJs using DirectLine JS

I am looking for a solution which has Customised Azure bot in website. I am not looking for an iFrame integration, As i have already explored. I need a solution which gives me an option to make UI changes in the bot window and invoke Live agent Chat window(Third party) from the existing Chatbot.
I tried these link below which dint help
https://github.com/Microsoft/BotFramework-WebChat
I understand exactly what you need.
It's true that the github url you pasted won't help but I know you'll get a lot of tips from the Direct Line and DirectLineJS documentation from the Advanced part.
You simply need a way to integrate to the Bot Framework from your existing UI system and hence using the Bot as just an Endpoint.
Your solution lies in the actual implementation methods for various channels that is supported by Bot Framework. Take Skype or Facebook for instance.
You need to study and configure WebHooks, Direct-Line Channels.
First: Use the Azure Portal to add a new website to your Bot in Channel property.
Secret Keys would be generated for you after then you can configure for version 1.1 or 3.0.
Check the Documentation here: https://learn.microsoft.com/bot-framework/rest-api/bot-framework-rest-direct-line-concepts
Now your site can be configured to talk to the Bot Framework via Web Clients and Sockets as API requests.
With these, you have the priviledge to use your own UI with the Bot Framework.

Which key to use in Bot.App secret property, one from Direct Line or Web Chat Channel?

I have configured a Web Chat Channel and a Direct Line Channel on Azure Bot Service. I am using the web chat control on the client side i.e. on a web page to provide a UI to users. For now I am using the Web chat control as it is i.e. included botchat.js in html served from my local server and also botchat.css which I have modified to give a custom look n feel.
There will be requirement in future where I might have to create a custom build of Web Chat control source code, to reduce the overall size of botchat.js file and do some custom implementation as well. My question is it right way to use the UI for a website. Please share your experience and best practice for the same. Are there any other ways to do UI for Website, because I want to support the flexibility of displaying various types of responses like text, video, hero cards etc.
Also, for now I am passing the secret key in the BotChat.App code, but I am confused which secret key to use, the one from WebChat Channel or DirectLine Channel.
To answer your initial question and per the official documentation found here (I'd recommend checking it out as well):
The Web Chat channel in the Bot Framework Portal contains everything you need to embed the web chat control in a web page. All you have to do to use the web chat control is get your bot's secret key and embed the control in a web page.
This refers to the WebChat channel this is of course if you were referring to connect your bot to Web Chat, Directline has the following purpose:
You can enable your own client application to communicate with your bot by using the Direct Line channel.
When it comes to UX/UI, I'd recommend the following blog post which provides some best practices and examples related to the area.

PubNub integration with PHP Server and Android Application

In my project I have to send user's location periodically (E.g. 30Sec) to server using Android application and the PHP server returns nearest users and app displays them on the map. I am looking for a publish subscribe protocol for the real time data transfer.
Here is the architecture I was planned. Each mobile app users id will be considered as a topic or channel so that we can send response to each user. PHP server will considered as a topic e.g. "APP_SERVER_TRACKER". All mobile apps publishes location to Server topic. Server prepares the list and publish response to individual user's by using their id as topics.
I would like to know how my PHP Backend Server subscribe topic?
In reality all my users are connecting to my PHP Backend Server using a single channel via PubNub. After getting location of each user server process it and publishes response to end user. In this scenario do I need to scale my PHP Server? Is there a way for directly handling all my customer request within the PHP Server itself? Please advice?
The application will target at least 10 Million users. should support half of concurrent users. PHP Server Hosting will be in AWS EC2 m3.2xlarge 8 core instance. Please let me know if AWS Server configuration is adequate?
PubNub Geohash Use Case
You don't need your PHP server to do this. Just have your Android app subscribe to a channel that is what is call a geo-hashed channel (a channel name based on your location). Your app will also publish its location to that channel.
So now you are receiving location updates from others near you while at the same time you are sending your location to those that are near you.
See PubNub Geohash use cases for more details.

Resources