Getting all event of a Bot(user) via Webhook - slack-api

I have read about the outbound webhook and Event api. And i am able to install a bot to a team using slack button. outbound webhook dosent fit in my scenario i think.
So how can i can get all events(specially whenever this bot receive a msg) using the event api to my webhook.?
Any direction or right way to solve this problem ..?

Outgoing Webhook and Event API are two completely unrelated functions. So you can not get event notifications through an outgoing webhook.
To get event notification your Slack App need to
request the correct oath scopes
subscribe to the events you want to get in the Slack App config
have a script ready to receive the event requests from Slack
Your script will then be called every time the subscribed event occurs.
For all details please have a look at the excellent official documentation about the Event API.

Related

how to listen to response from a webhook?

I am implementing webhooks with my payment solution (stripe), and I set up basic webhook server responses.
So, upon various events, such as updating a subscription, a server request is sent to a specific endpoint (/webhooks), and a 200 response is fired.
Now, I would like to listen to this server with my saga, but I'm not sure how to do that. The idea is I have a redux-saga event channel listening, and such an async request as updating a subscription status, would trigger a new saga. If for instance, the user updated his subscription status from paid to unpaid, his new status could reflect immediately in the UI.
Implementing this is not an issue when the event is triggered by the user. However, stripe allows me (as an admin) to trigger such events from Stripe's dashboard. If let's say I update one user's subscription status from Stripe's dashboard (because there is a bug with the UI for example), that will send a request to the webhooks endpoint on my server, but I'm not sure how to "intercept" it on the front-end, in order to then do what's needed for that user.
Do you have any suggestion ? I read about service workers, about pub/sub services. But I'm not sure they are the right way to do what i'm trying to do.
You'd need to implement either websockets or long polling from your frontend to your backend that looks for the updated response/data in your backend.

Twilio not sending webhooks in Progammable Chat

I would like to ask a question or maybe report a bug after solving my doubts. I started working with Programmable Chat and Twilio do not want to send a webhook to specific url but only when I'm sending message from my PHP code. I downloaded example node app and sending message from that, everything is working really nice, I'm getting post request from Twilio but if only I will send message from PHP, nothing at all. And strange is, after sending message from PHP, it will appear immediately in chat which means that it's working.
How does it possible? Could it mean that Twilio on theirs backend has an a bug when they receive message from PHP and becuase of that they are not fire webhook event?
I eliminated all differences, everything is that same beside that one message is sending from PHP and another from node. Same situation from API Explorer.
Gif presentation
Twilio developer evangelist here.
When you send messages to Programmable Chat from the REST API then webhooks aren't triggered. I think the reasoning is because you are making the call from your server, then your server is already aware that you are sending a message and you don't need to receive a webhook to do so. It also saves from the potential of infinite loops (if your webhook sends a message via the REST API, the requests would just go in circles).
So, it's not a bug, but a design choice. If you need to trigger your webhooks when you send a message from the REST API, you will need to make the webhook from your own server.

How do I receive a Twilio SMS into a Logic App?

How do I create a Logic App to receive an SMS?
I made some progress in my question here
I have been studying the information I found here
and have configured the Twilio Webhook to Call the Http endpoint when a message comes in.
following instructions similar to this
I copied the Request Body JSON from the instructions.
If I the Add A Twilo -Get Message Action it asks for the Unique SID of the message. I can't know this at Logic App Design Time, so how do I get it?
Instead letting Logic App to "retrieve" the message from Twilio, as mentioned in the comments, you should set up a webhook in Twilio's settings page to invoke Logic App ('s request trigger).

Emit custom events through Slack API

I'm trying to find a way to send events to a hubot running on Slack from, say, a python script. I've looked at the Events API documentation, but it only talks about how to receive information on events from Slack. Is there any way to emit an event to slack through the API?
No, you can only receive events from Slack with the Events API. But they are many other ways to interact with the Slack using the normal Slack API, e.g. sending messages to a channel.

Creating a Slack Webhook programmatically

Is there a way I can use the Slack API to create an incoming and outgoing webhook for a channel I just created?
No, I do not think that feature exists, but you can just use any existing webhook with the newly created channel or use the Event API to get the same result.
Incoming Webhooks
You can redirect an incoming webhook to any channel by providing the channel name as parameter in your call. (see Channel override)
Outgoing Webhooks
Your existing outgoing webhook will work with any channel, as long as you use triger words when you created them. If that is not an option, I would recommend to look at the new Event API that would allow you to get the same functionality as with outgoing webhooks, but without having to provide a channel name in the first place. Check out the event types message.channels and message.groups.

Resources