A Kalliope Neuron used to :
- POST messages on your own wall
- READ posts of an other wall
This neuron allows you to
- POST a message to your facebook wall.
- READ a number of messages from a user_name.
kalliope install --git-url https://github.com/kalliope-project/kalliope_neuron_facebook.git
The Facebook Neuron has multiple available actions : POST, READ.
Each of them requires specific options, return values and synapses example :
parameter | required | type | default | choices | comment |
---|---|---|---|---|---|
action | YES | String | None | POST, READ | Defines the action type |
token | YES | String | None | The facebook token | |
message | YES | String | None | The text to post |
Name | Description | Type | sample |
---|---|---|---|
action | the action USED | String | POST |
message | The text posted on the wall | String | Hi Kalliope |
- name: "post-facebook"
neurons:
- facebook_manager:
action: "POST"
token: "MY_SECRET_TOKEN"
message: "{{ message }}"
signals:
- order: "post on facebook {{ message }}"
parameter | required | type | default | choices | comment |
---|---|---|---|---|---|
action | YES | String | None | POST, READ | Defines the action type |
token | YES | String | None | The facebook token | |
nb_messages | No | int | 10 | number of messages to read | |
user_name | Yes | String | None | the user name |
Name | Description | Type | sample |
---|---|---|---|
action | the action USED | String | POST |
posts | The list of posts on the wall | List | ["hi there", "this is my wall", "Check out this new Kalliope neuron !"] |
user_name | The user name where to read message | String | BillGates |
- name: "read-facebook"
signals:
- order: "Read Facebook messages from {{ user_name }}"
neurons:
- facebook_manager:
action: READ
token: "MY_SECRET_TOKEN"
nb_messages: 3
user_name: "{{ user_name }}"
An example using the Jinja2 templates files:
- name: "read-facebook"
signals:
- order: "Read Bill Gates Facebook posts"
neurons:
- facebook_manager:
token: "MY_SECRET_TOKEN"
action: "READ"
user_name: "BillGates"
nb_messages: 3
file_template: neurons/facebook_manager/facebook_template_test.j2
The template defined in the facebook_template_test.j2
{% for post in posts %}
{{ user_name }} wrote {{ post }}
{% endfor %}
In order to be able to post on Facebook, you need to get a Facebook User access token.
- checkout on the facebook doc : https://developers.facebook.com/tools/explorer/
- log in with your facebook account.
- Click on "Get Token" and select "Get User Access Token"
- Select the rights you want for your token : for this neuron you need to check at least : "publish_actions" and "user_status" and "user_posts"
- Use your token in your kalliope neuron and post a message !