<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.larnitech.com/index.php?action=history&amp;feed=atom&amp;title=Webhooks%2Fen</id>
	<title>Webhooks/en - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.larnitech.com/index.php?action=history&amp;feed=atom&amp;title=Webhooks%2Fen"/>
	<link rel="alternate" type="text/html" href="https://wiki.larnitech.com/index.php?title=Webhooks/en&amp;action=history"/>
	<updated>2026-11-08T02:37:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.11</generator>
	<entry>
		<id>https://wiki.larnitech.com/index.php?title=Webhooks/en&amp;diff=20814&amp;oldid=prev</id>
		<title>FuzzyBot: Updating to match new version of source page</title>
		<link rel="alternate" type="text/html" href="https://wiki.larnitech.com/index.php?title=Webhooks/en&amp;diff=20814&amp;oldid=prev"/>
		<updated>2026-11-05T13:38:00Z</updated>

		<summary type="html">&lt;p&gt;Updating to match new version of source page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;languages/&amp;gt;&lt;br /&gt;
'''Webhooks''' connect the Larnitech system with any internet service that can send or receive HTTP requests (for example [[IFTTT (IF This, Then That)|IFTTT]]). They are set up in LT Setup on the '''Webhooks''' tab, which has two parts:&lt;br /&gt;
* '''Events''': the Larnitech server sends an HTTP request to an external URL when something happens in the system.&lt;br /&gt;
* '''Actions''': an external service sends an HTTP request to the Larnitech server, and the server changes the state of an item.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
An event has the following fields:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Field!!Description&lt;br /&gt;
|-&lt;br /&gt;
|Name||Name of the event. It is used in the script that sends the event.&lt;br /&gt;
|-&lt;br /&gt;
|URL||Address that the server calls.&lt;br /&gt;
|-&lt;br /&gt;
|Method||&amp;lt;code&amp;gt;GET&amp;lt;/code&amp;gt; (default) or &amp;lt;code&amp;gt;POST&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|Feedback||Optional. Item address and a regular expression: the value found in the answer is written to that item.&lt;br /&gt;
|}&lt;br /&gt;
The event is sent from a script. In LT Setup open '''Scripts → Scripts from logic → Add Blockly script''', add the device event on the '''Triggers''' tab, put the '''Make webhook''' block from the '''Automation''' tab into it and choose the event name.&lt;br /&gt;
&lt;br /&gt;
== Actions ==&lt;br /&gt;
An action has a name, an item and the state to set (on, off, reverse, level, mode, target temperature and so on, depending on the item type).&lt;br /&gt;
&lt;br /&gt;
To run an action, call the URL:&lt;br /&gt;
* in the local network: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://CONTROLLER_IP/webhook/?key=API_KEY&amp;amp;name=ACTION_NAME&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* over the internet: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://service.larnitech.com/webhook/?key=API_KEY&amp;amp;sn=SERIAL&amp;amp;name=ACTION_NAME&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;code&amp;gt;API_KEY&amp;lt;/code&amp;gt;: API key of the server (the &amp;lt;code&amp;gt;TCP-API&amp;lt;/code&amp;gt; key, see [[API2]]);&lt;br /&gt;
* &amp;lt;code&amp;gt;SERIAL&amp;lt;/code&amp;gt;: serial number of the server;&lt;br /&gt;
* &amp;lt;code&amp;gt;ACTION_NAME&amp;lt;/code&amp;gt;: name of the action from the '''Name''' field.&lt;br /&gt;
&lt;br /&gt;
The server answers with JSON. An error answer has &amp;lt;code&amp;gt;&amp;quot;result&amp;quot;:&amp;quot;ERROR&amp;quot;&amp;lt;/code&amp;gt; and a message, for example &amp;lt;code&amp;gt;Error Key&amp;lt;/code&amp;gt; (wrong key) or &amp;lt;code&amp;gt;Action not found&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
The settings are stored in &amp;lt;code&amp;gt;/home/settings/webhooks.json&amp;lt;/code&amp;gt;. Example with one event with feedback and two actions:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;events&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;997:1_button_pressed&amp;quot;,&lt;br /&gt;
      &amp;quot;url&amp;quot;: &amp;quot;https://maker.ifttt.com/trigger/997:1_button_pressed/with/key/YOUR_IFTTT_KEY&amp;quot;,&lt;br /&gt;
      &amp;quot;method&amp;quot;: &amp;quot;POST&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;447:145_sensor_state&amp;quot;,&lt;br /&gt;
      &amp;quot;url&amp;quot;: &amp;quot;https://example.com/weather.json&amp;quot;,&lt;br /&gt;
      &amp;quot;feedback&amp;quot;: { &amp;quot;addr&amp;quot;: &amp;quot;447:145&amp;quot;, &amp;quot;regexp&amp;quot;: &amp;quot;/\&amp;quot;temp\&amp;quot;:\&amp;quot;(-?[0-9]+)\&amp;quot;,/&amp;quot; }&lt;br /&gt;
    }&lt;br /&gt;
  ],&lt;br /&gt;
  &amp;quot;actions&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;401:1_lamp_on&amp;quot;,&lt;br /&gt;
      &amp;quot;status&amp;quot;: [ { &amp;quot;request&amp;quot;: &amp;quot;status-set&amp;quot;, &amp;quot;addr&amp;quot;: &amp;quot;401:1&amp;quot;, &amp;quot;status&amp;quot;: { &amp;quot;state&amp;quot;: &amp;quot;on&amp;quot; } } ]&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;401:1_lamp_reverse&amp;quot;,&lt;br /&gt;
      &amp;quot;status&amp;quot;: [ { &amp;quot;request&amp;quot;: &amp;quot;status-set&amp;quot;, &amp;quot;addr&amp;quot;: &amp;quot;401:1&amp;quot;, &amp;quot;status&amp;quot;: { &amp;quot;state&amp;quot;: &amp;quot;reverse&amp;quot; } } ]&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also: [[IFTTT (IF This, Then That)]], [[API2]].&lt;/div&gt;</summary>
		<author><name>FuzzyBot</name></author>
	</entry>
</feed>