Difference between revisions of "IFTTT"
Line 47: | Line 47: | ||
|} | |} | ||
− | + | {{note|Note that the password must be kept secret and should be long and difficult to guess, as it could otherwise be used to easily trigger events in HSYCO.}} | |
== Datapoints == | == Datapoints == |
Revision as of 16:54, 3 July 2018
This I/O Server implements two-way communication with the Webhooks service of IFTTT, allowing HSYCO to trigger applets in IFTTT and, the other way around, to receive notifications and data from applets.
Contents
IFTTT setup
The IFTTT I/O Server connects to IFTTT via its Webhooks service. It requires a fully functional Internet connection.
In order to setup an IFTTT applet that triggers an event and send data to HSYCO, connect the Webhook service to the "that" side of the applet.
The URL you specify must have the same server address and port number you use to access the HSYCO Web interface, followed by the /ifttt path and the password defined in the IFTTT I/O Server configuration, for example: https://example.hsyco.net:/ifttt/oieojdjeiw48394ejdejdd.
Note that this password must be kept secret and should be long and difficult to guess, as it could otherwise be used to easily trigger events in HSYCO.
The "Method" field should be set to POST, the "Content Type" field is not required, and add a static or dynamic text, for example the "TextField" ingredient of a trigger, to the "Body" field.
The IFTTT I/O Server can also be used to send trigger events to IFTTT's applets. The I/O Server will send a web request that will be received by a Webhook trigger. This request contains a text value and can optionally have an event name. If the event name is not set using the appropriate IO command's syntax, the event name passed to Webhooks is "hsyco".
On the IFTTT Webhooks page, click "Documentation" to retrieve the key and set the eventkey option of the I/O Server.
Define a new applet using the Webhook as the "this" trigger, enter the event name you want to use to identify this specific trigger, then add the "that" side of the trigger using the applet you need to trigger from HSYCO.
HSYCO Configuration
Add a IFTTT I/O Server in the I/O Servers section of the Settings and set the password.
High Availability
- Shutdown when inactive: defaults to false.
Options
ID | Default | Values | Description |
---|---|---|---|
password | password string (only use upper and lower case A-Z characters or digits, no space or special characters allowed, no length restrictions) | used to accept web requests from the Webhooks service |
Datapoints
ID | Value | R/W | Description |
---|---|---|---|
connection | online | R | connection established |
offline | R | HSYCO can't connect to the Telegram servers, or the bot token is not valid | |
bot | <bot name> | R | the name of the bot associated to the token. This datapoint is set only when the connection to the Telegram's servers is established, and the token is valid. You don't need to set the bot name to establish the connection, only the token string is required |
password | <registration phrase> | W | see Users registration. Note that writing the password datapoint overrides the password set as configuration parameter |
token | <token string> | W | see Communication and Telegram bot setup. Note that writing the token datapoint overrides the token set as configuration parameter |
enable | <user id> | W | when users registration is active, you can re-enable a user that was previously disabled |
disable | <user id> | W | when users registration is active, you can disable a registered user, so that messages originating from that user will be ignored |
message.<user id> | <message text> | R | the message text received from a user with id <user id>. This is a forced event, triggered on every message |
message.json | <JSON string> | R | received message, with all attributes, in JSON format. This is a forced event, triggered on every message |
message.<user id> | <text> | W | send a text message to user <user id> |
message.<user id>.<message id> | <text> | W | send a text message to user <user id>, as a reply to message <message id> |
message.all | <text> | W | when users registration is active, send a text message to all registered users that are currently enabled |
message.html.<user id> | <text> | W | send an HTML message to user <user id> |
message.html.<user id>.<message id> | <text> | W | send an HTML message to user <user id>, as a reply to message <message id> |
message.html.all | <text> | W | when users registration is active, send an HTML message to all registered users that are currently enabled |
Examples
Sending messages
Assuming that we are sending an SMS at 12 o' clock to user id 777123456, this is the EVENTS programming declaration:
time = 1200 : io telegram.message.777123456 = "I'm sending this message to you, my dear"
When users registration is active, you can send a message to all registered users that are currently enabled, also using a few HTML tags (as supported by the Telegram Bot API):
time = 1200 : io telegram.message.html.all = "I'm sending this message to you, <b>my dear</b>"
Send a message with a custom keyboard:
time = 1200 : io telegram.message.777123456 = "Do you like my message? [[Yes,No]]"
Receiving messages
Hsyco can receive Telegram messages and perform actions according to the text contained in the message.
io telegram.message.777123456 = "Yes" : io telegram.message.777123456 = "Thank you!" io telegram.message.777123456 = "No" : io telegram.message.777123456 = "Why not? You are so mean!"
Release Notes
3.7.0
- initial release
IFTTT is a registered trademark of IFTTT Inc.