Receive slack bot messages via requests to external URL - google-app-engine

Is it possible to receive direct messages on behalf of a slack bot via POST requests to a certain domain?
I want to have an endpoint in Google App Engine that receives incoming direct messages from Slack via POST requests, and posts messages back via the API. Is it possible?

You can use the new Events API. Create a bot, subscribe to message.im events, and set your endpoint as the callback URL

You just need to set up an "outgoing webhook"in slack and point it to whatever endpoint you need on your GAE server. In order to respond just use an "incoming webhook" to receive the answer.

Related

does watson assistant know if there is null response from user?

I have created a chatbot in Watson assistant and I need a condition where if there the user goes silent for 10 seconds I continue the conversation. is there a way for Watson to know if there is no response (null response)?
Also, does Watson know if the user clicked on a link? is clicking on a link considered a response in Watson?
Watson Assistant does not know if a user hasn't sent back a response,
you can do one of the following:
if you are using WA web chat channel, use the events provided to control the flow. You can set a timer via pre:recieve and reset it if the user did send a message via pre:send.
if there is a timeout send a message via send operation.
Alternatively, if you plan on supporting more than just a web chat channel (e.g. facebook, phone, whatsapp, etc.), you are better off implementing the same logic in a Post Message webhook and . Essentially, make your code keep a timer in the Post message and if a user send a reply, turn the timer off in a Pre Message webhook

How to handle incoming message to create a conversation in Twilio conversation api?

I have a chat app link now I need to add a SMS participant.
My use case is say you have a number and you send a message in my twilio number. Now I want to create a conversation between us.
I need to know what are the steps to handle an incoming message using webhook and create a private channel so that it automatically creates a conversation between the twilio number and the user. I am not able to capture the message in my backend api endpoint which I specified in pre-event and post-event webhook under conversations.Any help would be appreciated.
You will find the steps required for turning an inbound SMS message into a conversation message in the documentation on Inbound Message Handling & Autocreation. All I can do is recommend you read through there.

How do I send Alexa smarthome proactive changeReports from a sensor?

I am using LWA as my oauth2 provider and need to send change reports when my contact sensors change state. Because of LWA account linking I've determined that I will have to store access and refresh tokens in a database from my skill. If that's the case, then the only way to send a report is to have my server send data to the skill which sends the actual directive to the endpoint. If that is the case, how do I create a separate trigger or function that will receive data from my server, repackage it and send to the endpoint?
And if the best way to do this is to have my server contact the endpoint directly, which seems more elegant to me, how would I get the necessary tokens or auth code to my server for storage?
When sending events to Alexa Event Gateway, there's no requirement on whether to send it through your skill Lambda v.s. your backend server. As long as you have the access token of the user, you can send the event from anywhere you want.
I think the easiest way to implement this is to have your skill stores the access and refresh token in DynamoDB. When the device state changes, your backend server would retrieve the access token from DynamoDB and then send the event to Alexa Event Gateway.

AngularJs: Respnd to Http post from third part server

I am developing an app using AngularJS and NodeJS. Being new to both I am struggling a bit.
My app is communicating with payment gateway to facilitate payments. Flow goes like MyApp-->Payment Gateway --> MyApp. I am able to send the request to payment gateway. Problem is I am not able to figure out how I will handle response that is coming from payment gateway. Payment Gateway is sending some data in the post request. I need to process this data before showing results of transaction to user.
Technically speaking I know what needs to be done. Like Step 1) Giving a return URL to Payment Gateway to which Post request will be sent. Step2) This HTML URL of my application will send data received from payment gateway to server side for processing. Step3) Based on processed results I will show transaction result to user.
Where I am struggling is show to achieve this using AngularJS and Nodejs. Pls help
You can use Angular's $http service to easily send and get data from server.

Convert email to http request with App Engine

Is there a way to send http request (to a specific url address) each time i receive email (Google account), with the content of the email received using Google App Engine?
As per your question, it seems that you already have an Incoming Email Handler in your App Engine application.
If the above is true, then in the Incoming Email Handler, you can parse out the message and if it meets your condition for invoking the http request, then you can definitely do that. You can use the URL Fetch service for the same.
One design decision you might want to do is whether you want to keep all your URL Fetch code inside of the incoming Email Handler or you want that to be handled externally via a Task Queue. In that case, I suggest that you can use the Task Queue to create a task when an incoming email comes in to your handler. Then the Task Queue logic can take care of one or more things, which includes invoking the HTTP Service, as you wanted.

Resources