The Palver Data API package provide functions for simple usage of our data by clients in R. Palver is a startup for social listening, we collect and analyze data from a diverse range of sources, such as, public WhatsApp chats, public Telegram chats, TikTok profiles, Reddit forums, radio stations and much more.
You can install the development version of palver:
install.packages('devtools')
devtools::install_github(repo = 'palverdata/palver_api')
Here we provide examples on how to use palver functions in order to request data from Palver API. Firstly, you should have a login at our plataform that enable you to collect Palver data, if you want to understand how our API works, send an e-mail to [email protected].
Now, if you have a login, your e-mail and password for the login enable you to have a token, which is a key to access our data.
Of course, the example below should return an error, as we can not provide a real login, but you can have an idea of what your command should look like!
library(palver)
# The code below will return an error: of course, imagine if a fisherman would have such obvious e-mail and password!
# my_token <- get_token(email = '[email protected]', password = 'ilovefish')
With your token in hands, we can show how you can make requests in our data set that returns a tibble! Let’s say you want to have access to all messages that contain the terms “fish” or “sea” or “boat”, but you do not want messages with the word “mermaid”. Therefore, you can make this Boolean Lucene query: (fish OR sea OR boat) AND NOT mermaid. And you also want to see it in messages from Telegram, only in English, and from first of January of 2021 to second of March in 2023. The request should be as it follows:
# The code below will not work if you do not have a token
start_date <- date_iso_format(day = 01, month = 01, year = 2021, timezone = 'America/Sao_Paulo')
end_date <- date_iso_format(day = 02, month = 01, year = 2021, timezone = 'America/Sao_Paulo')
# request_messages(query = '(fish OR sea OR boat) AND NOT mermaid', source = 'telegram', lang = 'en', startDate = start_date, endDate = end_date, token = my_token)
Other request functions works as the same: you can request for chat data, trends and messages.