How to fetch contents from WordPress made website using Alexa skill?

Viewed 123

I am working on custom Alexa skill and i want to fetch contents from Website which is made by WordPress. How can Alexa skill fetch contents directly from website ?

2 Answers

I think there are two possible solutions which can be used here.

First one would be to write a bot which opens the website in a scheduler and writes the contents your looking for to a database. After that you access the database (for example with a RestAPI) and use the information in your skill.

Alternatively you directly open the website in your skill (a way to do this is in NodeJS shown here) and gather the information you need and use it in your skill.

Advantages and disadvantages of the 1st solution:

(+) Can handle any amount of requests without overloading the website

(+) Data can be used for other purposes too

(-) Not (really) live

(-) Data is even saved if know one accesses it

Depending on the amount of users you expext, the performance reliability of the website and how often new information is published and how live the data you skills gets has to be, I'd choose from those.

If this is java, use https://jsoup.org. I did create an alexa skill for a system for which I didnt get an access to APIs and hence needed to parse the html pages on the go.

With jsoup, you can just tell which url to parse and then navigate to appropriate dom element using its handy and easy to use function.

So your call flow will be like - Receive alexa skill request in your skill handler, use jsoup from handler to parse html page url , fetch data from html and prepare speech to return.

Related