The synchronization of the content from your website can be done by several ways. We will emphase synchronization via the RSS feed from your website. A tool called Zapier will allow us to poll your website every 15 minutes in order to send the last posts on your application.
Estimated time of setup: 10 minutes
1/ Your RSS feed
Your RSS feed presents as this icon which locates (often) on top or bottom of your website.
If your goal is to retrieve the content of a website edited with a CMS (as Wordpress, Joomla, Ghost, Drupal ...), the RSS feed will be available natively. Our blog will be our example, https://blog.mysocialapp.io provides a RSS feed, which is available at the address https://blog.mysocialapp.io/rss/.
Note: if you have difficulties to find your RSS feed, don't hesitate to contact us to make us help you.
2/ Generate an "API key" on your application
a/ Login on your your API key management console, and add a new API key by clicking on the "+ new API key" button.
b/ A window will pop up, asking you to add a description. This one will make it possible to identify this key later, in case of dismissal if needed.
c/ Once validated, a token is generated, this token must never be disclosed! Keep it safely and don't hesitate to dismiss it in case of doubt. This one gives access to all data of your application.
The "endpoint" is the address (URL) of your application's API, you have also to keep it apart for later.
Optionally (but recommended): Once your API key created, you can click on it to give fake first name and last name to your service account. This one will be visible to the users, so let's make it more "human" :)
You will be thus able to change its information, which is visible to the application's users
Elements to update to appear more "human-like":
- First name
- Last name
To summarize: at this point you own an API key, as well as the address of your application's API (endpoint).
3/ Login on Zapier
We will use the Zapier platform, which will allow you to easily interconnect your website (in our case blog.mysocialapp.io) and your MySocialApp application.
1.a/ Firstly, you have to create your account on Zapier. The free plan will be enough for our use case.
1.c/ Insert the address from your RSS feed (in our case https://blog.mysocialapp.io/rss/)
Zapier will confirm you that the feed is valid
We get to the most technical part of this post, you should have with you:
- Your API address (URL) ending with mysocialapp.io
- Your secret API key
2.a/ Fill in your API address in the "URL" field and add "/api/v1/feed/message" at the end, as in the example below. This end of URL allows to specify where to send the RSS news on your application. In the example we will send it on the news feed
To access the next options, you must click on "Show advanced options".
2.b/ Choose the JSON "Payload type" (JSON if the message format used to communicate with your API)
2.c/ Here you will create the wanted template of your message by using data from your RSS feed. This field is composed by 2 parts, the left part which is the "keys", and the right part which is the "values". We inserted 2 mandatory keys, "message" for the content of the message to publish on the news feed, and "access_control" which allows to mark this post visible for all, as it is "PUBLIC" (warning: upper-cased characters are does matter !).
You can access to data from your RSS feed by clicking on the button (surrounded by red above), giving access to a list of elements. You are free to compose your message as you wish.
3 fields has been selected, "Title", "Content" (of the post) et "Link" (to your website's post).
2.d/ Here are the values to put in the fields. "File" and "Basic Auth" must be kept empty.
2.e/ The last field concerns the "headers" of the request we will do, that's here we will put the API key for our publication to be authorized by your application. In the left field, you have to put "Authorization" and in the right field your secret API key.
At this point, we can validate this step, and go on to the validation
4/ Validate the system
Once you have sent a test to your application by clicking on the "Send test to webhooks by Zapier" button.
Then, you should see a new content published on the news feed of your application by the user which is associated by you API key (in our case, I called this user Julia RSS Bot, cf: step 2/c)
As we can see, the content has been published and is available to be commented and liked by your users.
You can validate your Zapier task and give it a name. This one will run every 15 minutes and will synchronize the content of your website with your application.
Don't hesitate to repeat this task if you wish to add other sources of content to your application.