This library adds blocks to use the Twitter actions allowing to send tweets with or without attachments, as well as direct messages. You need the Twitter binding installed and properly configured.
Blocks
Send a simple tweet.
Send a tweet with an attachment.
Proof it works: : https://twitter.com/yschaus/status/1470124826069192704
Send a direct message.
Changelog
Version 0.1
- initial release
Resources
uid: twitter
tags: []
props:
parameters: []
parameterGroups: []
timestamp: Dec 12, 2021, 9:13:42 PM
component: BlockLibrary
config:
name: Twitter
slots:
blocks:
- component: BlockType
config:
args0:
- name: MESSAGE
type: input_value
- name: ACCOUNT
type: input_value
colour: "#55acee"
helpUrl: ""
inputsInline: true
lastDummyAlign0: right
message0: tweet %1 from account %2
nextStatement: ""
previousStatement: ""
tooltip: ""
type: tweet
slots:
code:
- component: BlockCodeTemplate
config:
template: >
{{utility:things}}.getActions('twitter', {{input:ACCOUNT}}).sendTweet({{input:MESSAGE}});
toolbox:
- component: PresetInput
config:
fields:
TEXT: What's up?
name: MESSAGE
shadow: true
type: text
- component: PresetInput
config:
name: ACCOUNT
shadow: true
type: oh_thing
- component: BlockType
config:
args0:
- align: right
name: MESSAGE
type: input_value
- align: right
name: ACCOUNT
type: input_value
- align: right
name: URL
type: input_value
colour: "#55acee"
helpUrl: ""
inputsInline: false
lastDummyAlign0: right
message0: tweet %1 from account %2 with attachment %3
nextStatement: ""
previousStatement: ""
tooltip: ""
type: tweet_with_attachment
slots:
code:
- component: BlockCodeTemplate
config:
template: >
{{utility:things}}.getActions('twitter', {{input:ACCOUNT}}).sendTweetWithAttachment({{input:MESSAGE}}, {{input:URL}});
toolbox:
- component: PresetInput
config:
fields:
TEXT: What's up?
name: MESSAGE
shadow: true
type: text
- component: PresetInput
config:
name: ACCOUNT
shadow: true
type: oh_thing
- component: PresetInput
config:
fields:
TEXT: url
name: URL
shadow: true
type: text
- component: BlockType
config:
args0:
- align: right
name: MESSAGE
type: input_value
- align: right
name: RECIPIENT
type: input_value
- align: right
name: ACCOUNT
type: input_value
colour: "#55acee"
helpUrl: ""
inputsInline: false
lastDummyAlign0: right
message0: direct message %1 to %2 from account %3
nextStatement: ""
previousStatement: ""
tooltip: ""
type: direct_message
slots:
code:
- component: BlockCodeTemplate
config:
template: >
{{utility:things}}.getActions('twitter', {{input:ACCOUNT}}).sendDirectMessage({{input:RECIPIENT}}, {{input:MESSAGE}});
toolbox:
- component: PresetInput
config:
fields:
TEXT: "@someone"
name: RECIPIENT
shadow: true
type: text
- component: PresetInput
config:
fields:
TEXT: What's up?
name: MESSAGE
shadow: true
type: text
- component: PresetInput
config:
name: ACCOUNT
shadow: true
type: oh_thing
- component: PresetInput
config:
fields:
TEXT: url
name: URL
shadow: true
type: text
utilities:
- component: UtilityJavaType
config:
javaClass: org.openhab.core.model.script.actions.Things
name: things