No internet connection
  1. Home
  2. Ideas

Feature request: Webhooks

By Christian Scheuer @chrscheuer
    2020-12-05 20:16:11.858Z

    We'd love to be able to make automations that react to actions the users take on our forum.

    For example, we'd like to create items on a board in Monday.com or Trello whenever a new page/thread is made in certain categories of the forum.

    We'd also like to make automations that react to a user's interactions on the forum, ie. every time they make a new page/thread, or a post. Their interactions on the forum will help us understand how well a user is experiencing our product / how engaged they are, and so will help us improve onboarding.

    I believe setting up a webhook shouldn't be too hard – but maybe there are things I don't know yet. Lmk if you need any technical input or suggestions @KajMagnus :)

    • 2 replies
    1. Lmk if you need any technical input or suggestions

      Yes please. So this is about outgoing webhooks — I mean, Talkyard POSTs data to by you configurable URLs, when something happens in Talkyard?

      What data would you want to be included in a webhook for example? To create new things in Monday or Trello, I suppose you need the new topic title and url at least — what about the topic text, and author name?

      a user's interactions ... every time they make a new page/thread, or a post

      Then I'm guessing it'd also be nice to know the name of the person who replied, what s/he wrote, and who s/he replied to?

      ***

      This'd be a nice thing to do next (just making Talkyard work well with Azure AD first)
      — because next on the roadmap is to slightly integrate Talkyard with Mattermost, Slack etc. And they have incoming webhooks, e.g. Mattermost:

      https://developers.mattermost.com/integrate/incoming-webhooks/

      Incoming webhooks let you POST some data to a Mattermost endpoint to create a message in a channel.

      [The webhook looks] something like this:

      https://your-mattermost-server.com/hooks/xxx-generatedkey-xxx

      Treat this endpoint as a secret. Anyone who has it will be able to post messages to your Mattermost instance.

      ... make the following request:

      POST /hooks/xxx-generatedkey-xxx HTTP/1.1
      Host: your-mattermost-server
      Content-Type: application/json
      Content-Length: 63
      
      {"text": "Hello, this is some text\nThis is more text. :tada:"}
      

      And it seems you need sort of the same thing?
      You (or is it Trello and Monday) also have incoming webhooks?

      Should Talkyard post directly to Trello or Monday etc — or to a server of yours, which maybe would look at the message, possibly transform it somehow, and forward it to Trello, Monday etc, maybe depending on what type of message it is?

      ***

      Here's what Mattermost includes in their outgoing webhooks: (https://developers.mattermost.com/integrate/outgoing-webhooks/ )

      Outgoing webhooks let you receive an event as an HTTP POST when messages get posted into a Mattermost channel

      POST /your-url HTTP/1.1
      Content-Length: 378
      Host: <your-host-name>
      Accept: application/json
      Content-Type: application/json
      
      {
        "channel_id": "hawos4dqtby53pd64o4a4cmeoo",
        "channel_name": "town-square",
        "team_domain": "someteam",
        "team_id": "kwoknj9nwpypzgzy78wkw516qe",
        "post_id": "axdygg1957njfe5pu38saikdho",
        "text": "some text here",
        "timestamp": "1445532266",
        "token": "zmigewsanbbsdf59xnmduzypjc",
        "trigger_word": "some",
        "user_id": "rnina9994bde8mua79zqcg5hmo",
        "user_name": "somename",
        "file_ids": "znana9194bde8mua70zqcg5hmo"
      }
      

      And:

      Upon receiving one of these requests, your integration should immediately confirm that the token provided in the request body matches the one given to you after the webhook was created

      1. CChristian Scheuer @chrscheuer
          2020-12-07 10:00:02.622Z

          It's not normal that a service would send something straight from its own outgoing webhook to some other service's incoming webhook, unless you then also implement the rest of the integration with OAuth2 etc.

          I think Talkyard should as a first thing just do normal outgoing webhooks.
          That's enough for everything.

          Anybody could then implement an integration by listening to those webhooks and forward whatever they want to Mattermost, Slack, Monday, Trello, Intercom or wherever else.

          It's normal for webhook payloads to contain a container with parameters such as the event name, event time, and then the relevant content object(s) in parallel, for example, the page, the post, etc.

          See here for a couple of examples:
          https://stripe.com/docs/api/events/object

          https://apidocs.chargebee.com/docs/api/events
        • Progress
          with doing this idea
        • @KajMagnus marked this topic as Planned 2020-12-07 05:21:28.190Z.