You can have a Twitter WebHook for your Kynetx application by using Notifo and the Push.ly services. Herein are the configuration steps and a simple HelloWorldish Kynetx application. Your Kynetx application will be called where your Twitter account receives a DM, mention, gets a new follower or when someone favorites one of your tweets. Let's jump right into the configuration steps!

For this demo we will be using the aculishook (Aculis WebHook) Twitter account. The first thing you will need to do is to Sign Up for a Notifo account. For this demo we will be using the aculishook account. After you have set up an account at Notifo head on over the Push.ly and sign in with your Twitter account. Once you are signed into Push.ly, enter your Notifo username and select the actions for which you would like notifications (aka WebHook calls). From the screenshot below you can see that I have selected all the actions.


Now let's head back to Notifo to set up the WebHook call into our Kynetx application. On the Notifo site visit the notifications page (Login then click Settings and click on Notification Settings). Then fill out the "Notification Webhook URL" field then click Save.


The construction of the WebHook URL for a Kynetx application is described in the online Kynetx documentation for Webhook Endpoints:

http://webhooks.kynetx.com:3098/h/{appid}/{eventname}

The appid is the Kynetx application identifier assigned automatically when you created your application. You don't have any choice to make here, just cut & paste. For this demo the appid was a169x151. The eventname is completely in your hands, choose something meaningful as you will also need to use it as an event name in your Kynetx application. For this demo application the eventname is notifohook.

Finally we have the Kynetx application which will receive the WebHook calls from Notifo. The bit of Kynetx code that enables your application to respond is in the select statement:

select when webhook notifohook

Notice that eventname notifohook is the same one that was used in the WebHook URL enter at Notifo? Notifo WebHook calls pass along ten parameters which are available as event:param("") within your Kynetx application. This demo application does not do anything particularly interesting with the data received, it's just saved to a Google form.

ruleset a169x151 {
  meta {
    name "Aculis WebHook"
    description << Aculis demo of Kynetx Twitter Webhook  >>
    author "Ed Orcutt"
    logging on
  }

  dispatch {
    domain "example.com"
  }

  global { }

  rule Notifo_Webhook is active {
    select when webhook notifohook
    pre {
      notifo_id          = event:param("notifo_id");
      notifo_message     = event:param("notifo_message");
      notifo_service     = event:param("notifo_service");
      notifo_signature   = event:param("notifo_signature");
      notifo_title       = event:param("notifo_title");
      notifo_to_username = event:param("notifo_to_username");
      notifo_type        = event:param("notifo_type");
      notifo_unix_time   = event:param("notifo_unix_time");
      notifo_uri         = event:param("notifo_uri");
      notifo_webhook_url = event:param("notifo_webhook_url");
    }
    every {
      http:post("https://spreadsheets.google.com/a/aculis.net/formResponse?formkey=dElUWGxHSmppczd5Mnl3S0dRaWE0X1E6MQ&ifq")
        with params = {
          "entry.0.single": notifo_id,
          "entry.1.single": notifo_message,
          "entry.2.single": notifo_service,
          "entry.3.single": notifo_signature,
          "entry.4.single": notifo_title,
          "entry.5.single": notifo_to_username,
          "entry.6.single": notifo_type,
          "entry.7.single": notifo_unix_time,
          "entry.8.single": notifo_uri,
          "entry.9.single": notifo_webhook_url,
          "submit": "Submit",
          "pageNumber": "0",
          "backupcache": ""
        };
    }
  }
}

You can take this demo for a test drive by following the Twitter account aculishook, mentioning @aculishook in a tweet or by favoring one of aculishook's tweets. Then visit the Google Form to see the results. The web page view of the Google spreadsheet is only updated every 5 minutes, so there will probably be a delay before you can see the effect of your action. However, the actually Google spreadsheet is updated immediately from the Kynetx application.

Do let me know if you have found this information useful or if you have any questions!

Enjoy!