{"id":14066145,"url":"https://github.com/Phippsy/brandwatchR","last_synced_at":"2025-07-29T22:30:57.888Z","repository":{"id":56937190,"uuid":"120597190","full_name":"Phippsy/brandwatchR","owner":"Phippsy","description":"Access the Brandwatch API from R. Poorly maintained as I no longer have a Brandwatch login, sorry.","archived":false,"fork":false,"pushed_at":"2018-08-16T14:09:27.000Z","size":101,"stargazers_count":11,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-24T02:48:36.403Z","etag":null,"topics":["api","brandwatch","r","textmining"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Phippsy.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-07T10:01:14.000Z","updated_at":"2024-06-23T21:02:06.000Z","dependencies_parsed_at":"2022-08-21T07:20:43.542Z","dependency_job_id":null,"html_url":"https://github.com/Phippsy/brandwatchR","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Phippsy/brandwatchR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phippsy%2FbrandwatchR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phippsy%2FbrandwatchR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phippsy%2FbrandwatchR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phippsy%2FbrandwatchR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Phippsy","download_url":"https://codeload.github.com/Phippsy/brandwatchR/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phippsy%2FbrandwatchR/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267772257,"owners_count":24142086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","brandwatch","r","textmining"],"created_at":"2024-08-13T07:04:57.548Z","updated_at":"2025-07-29T22:30:57.526Z","avatar_url":"https://github.com/Phippsy.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n# brandwatchR\n\n[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/brandwatchR?color=brightgreen)](https://cran.r-project.org/package=brandwatchR)\n![](http://cranlogs.r-pkg.org/badges/brandwatchR?color=brightgreen)\n\nAn API wrapper package for the [Brandwatch API](https://developers.brandwatch.com/docs/).\n\nIf you're like me and you just want to get your hands on lots of lovely mention data, you do that by:\n\n- Authenticating with `bwr_auth()`\n- Working out the project id you need with `bwr_projects_get()`\n- Working out the id of the query you want results for with `bwr_queries_get()`.\n\nFrom here, you can retrieve mentions data using `bwr_get_mentions()`, which takes the project ID and query ID as arguments.\n\n\n## Install\n\n```r\ndevtools::install_github(\"Phippsy/brandwatchR\")\n```\n\nor install from CRAN, version 0.3.0\n\n```{r message = FALSE, warning = FALSE}\ninstall.packages('brandwatchR')\n```\n\n## Authenticate\n\nOnly username and password are mandatory. \nYou can optionally specify `refresh = TRUE` to force the function to obtain a new token from the API. Otherwise it will read a cached local file if available. \nYou can also optionally specify `cache = FALSE` if you prefer not to have your token cached locally. In this case, your token will be stored in a local environment variable and available for the current R session only.\n\n```r\nbwr_auth(un = \"your@username.com\",\n         pw = \"your_password\",\n         refresh = TRUE,\n         cache = TRUE)\n```\n\n## Get project info\n\n```r\nmy_projects \u003c- bwr_projects_get()\nhead(my_projects)\n```\n\nThis will display a data frame of project information including project ID, description, creation date and more.\n\nRead the [Brandwatch documentation for more info](https://developers.brandwatch.com/docs/retrieving-projects)\n\n## Get queries for a project\n\nOnce you have a project ID, you can find out all the available queries in your environment. Do this using the `bwr_query_get()` function:\n\n```r\n# We arbitrarily pull the first available project ID\nmy_project \u003c- bwr_projects_get()$id[1]\n\n# Get list of queries for this project ID\nmy_query \u003c- bwr_query_get(project_id = my_project)\n```\n\nThis will return a data frame showing you the ID, name, created date and similar metadata for the queries in the specified project.\n\n## Get mentions for a query\n\nFinally, the fun stuff - we can now request all mentions for a given query, using a specified date range. We achieve that using the `bwr_mentions_get()` function.\n\n```r\nmy_mentions \u003c- bwr_mentions_get(\n  project_id = my_project,\n  query_id = my_query,\n  date_range = c(\"2018-01-01\", \"2018-02-01\"))\n```\n\nThis will return a data frame containing the mentions for your specified query. Brandwatch returns a *ton* of fields in the API response, so it's likely that you'll want to slim down the resulting data frame by using `dplyr`'s `select()` function or similar.\n\nYou can find information about the mention field definitions within [Brandwatch's API documentation](https://developers.brandwatch.com/docs/mention-metadata-field-definitions).\n\n\n## All functions currently available\n\n#### Authentication\n\n- `bwr_auth()` authenticate\n\n#### Projects\n\n- `bwr_projects_get()`- get a dataframe of projects\n\n#### Queries / mentions\n\n- `bwr_query_get()` - get a dataframe of queries for a project\n- `bwr_query_check()` - check the syntax of a query \n- `bwr_query_create()` - upload a new query\n- `bwr_query_delete()` - delete a specified query\n- `bwr_mentions_get()` - get the mentions for a specified query\n- `bwr_mentions_total()` - get the total number of mentions for a specified query or query group.\n- `bwr_mentions_topics()` - get the matching topics \u0026 topic metadata for a specified query or query group.\n- `bwr_mentions_topsites()` - get the top authors for a specified query or query group.\n- `bwr_mentions_toptweeters()` - get the top tweeters for a specified query or query group.\n\n##### Query filters\n- `bwr_filters_get()` - Get a data frame of all parameters which can be used to filter your query\n- `bwr_metrics_get()` - Get a data frame of all metrics which have limited accepted values.\n\n##### Query Groups\n\n- `bwr_querygrp_get()` - get the query groups for a specified project\n- `bwr_querygrp_delete()` - delete a specfied query group\n\n#### Tags \n\n- `bwr_tag_get()` - get the tags for a specified project\n- `bwr_tag_create()`  - create a new tag for a specified project\n- `bwr_tag_delete()` - delete a tag for a specified project\n\n#### Categories\n\n- `bwr_cat_get()` - get the categories for a specified project\n- `bwr_cat_create()`  - create a new category for a specified project\n\n#### Rules\n\n- `bwr_rule_get()` - get a data frame of all rules available within the specified project.\n- `bwr_rule_delete()` - delete a rule for a specified project and rule id\n\n#### Charts\n\n- `bwr_mentions_chart()` - get a data frame of chart-ready statistics for a specified query or query group.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPhippsy%2FbrandwatchR","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPhippsy%2FbrandwatchR","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPhippsy%2FbrandwatchR/lists"}