Posted by Andrea Volpini 6 years ago

Few weeks ago I did a very basic experiment to create, for one of our test websites, a bot on Telegram and to feed it with data coming from their WordPress website.

Camminando Con is a trekking organization, offering hiking tours in a small valley one hour from Rome and the content structure of their website reflects their simple business model. They use WordLift to structure this content in a way that allows them to exploit it in several ways. 

WordLift helps digital editors organizing and structuring the content of a website. WordLift creates open datasets of all the things that matter and publishes them as open data.

Website Content Structure | WordLiftPresenting their excursions – structured by WordLift as events using the vocabulary – they describe all the sites they visit on their tours – represented as places in – so that anyone, by reading their site, can get a good understanding of the upcoming events and the territory they will explore.

This structured data is then connected through WordLift’s interactive map and discovery widgets that allow their users to explore related content.

Once the content work is done, they promote it via their website and an active Facebook page. I thought I could add a new interaction channel to their communication plan, leveraging the knowledge graph they create event after event. 

Let’s build the Bot

Telegram is a messaging platform similar to WhatsApp, WeChat or Facebook Messenger that lets users communicate in groups or one-to-one. I’ve chosen Telegram because chat-bots can be easily created: you simply chat with another Bot called the ‘BothFather’ (just look for it and add it to your contact list) and your automata will be ready to go in a second. Here are the steps you need to follow:

BotFather supports several commands; to create a new Bot open a chat with him and send the /newbot command.

Bot Father

Bot Father

Take note of the API key (token) and remember that a bot always uses a user name ending in bot (i.e. WordLiftBot).

Telegram Camminando Con | WordLiftNow create a new public (or private) channel and add the bot as administrator of the channel (the bot does’t appear in the list of friend so you will need to remember its name and type it – WordLiftBot in our case).

Your Bot is now the admin of the chat channel. Not bad in just few minutes, right? What’s next?

Next we need to get an update every time a new event is published on the CamminandoCon website. In the CamminandoCon website, as seen earlier, events are constantly updated to promote the upcoming hiking tours and every event focuses on 3 or 4 locations at the time (villages or point of interests that will be seen while walking).

To recall their events we are going to use an HTTP end-point that WordLift adds to every website: http://<yourwebsite>/wl_entity_type/event; through this end-point we can get an ordered list of all the events published on the site; adding /feed/ to this URL (http://<yourwebsite>/wl_entity_type/event/feedthe list is automatically converted by WordPress into an RSS feed that we can use with our Bot. 

IFTTT CommandTo glue our Telegram Bot with the RSS feed coming from WordLift – without writing a single line of code – I used IFTTT. Get a login there (if you don’t have one already) and create a new recipe IF > Feed adding the RSS feed generated by WordLift.

The THEN part is a Maker (a simple app that lets you send web requests to publicly available APIs) and here is how to configure it:
IFTTT Recipe | WordLift

Last, you have to use the API key received by the Bot Father and add it before the /sendMessage as shown above (<your-api-key>/sendMessage). The method is set to POST and the Content Type is application/x-www-form-urlencoded. The Body contains the actual message that the Bot shall send. Here we can see we’re asking to send the update in the @CamminandoCon channel and the text is a combination of elements derived from the RSS feed such as the Title, the URL and the Image.

Here is the result as seen on the Telegram desktop client.

Telegram | WordLift

Happy Bot development!

Must Read Content

Why Do We Need Knowledge Graphs?
Learn what a knowledge graph brings to SEO with Teodora Petkova

2x Your Video SEO in 3 Simple Steps
Use videos to increase traffic to your websites

SEO Automation in 2021
Improve the SEO of your website through Artificial Intelligence

The Power of Product Knowledge Graph for E-commerce
Dive deep into the power of data for e-commerce

Touch your SEO: Introducing Physical SEO
Connect a physical product to the ecosystem of data on the web

Are you ready for the new SEO?
Try WordLift now!

Learn how to use structured data to get better SEO rankings. Practical SEO tips, webinars, and case studies right in your inbox once a week.

Learn how to use structured data to get better SEO rankings. Practical SEO tips, webinars, and case studies right in your inbox once a week.

Congrats you are in!

Stand out on search in 2019. Get 50% off WordLift until January 7th Buy Now!