{"id":15893606,"url":"https://github.com/csgillespie/rtypeform","last_synced_at":"2025-07-23T15:07:32.335Z","repository":{"id":56936079,"uuid":"55159799","full_name":"csgillespie/rtypeform","owner":"csgillespie","description":"An R interface to the 'typeform' API.","archived":false,"fork":false,"pushed_at":"2025-02-04T08:44:31.000Z","size":1445,"stargazers_count":16,"open_issues_count":5,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-06T16:47:15.776Z","etag":null,"topics":["cran","r","typeform"],"latest_commit_sha":null,"homepage":"http://csgillespie.github.io/rtypeform/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csgillespie.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-31T15:06:42.000Z","updated_at":"2025-04-09T10:11:01.000Z","dependencies_parsed_at":"2023-01-30T14:45:34.712Z","dependency_job_id":null,"html_url":"https://github.com/csgillespie/rtypeform","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/csgillespie/rtypeform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csgillespie%2Frtypeform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csgillespie%2Frtypeform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csgillespie%2Frtypeform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csgillespie%2Frtypeform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csgillespie","download_url":"https://codeload.github.com/csgillespie/rtypeform/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csgillespie%2Frtypeform/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265349122,"owners_count":23751295,"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","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":["cran","r","typeform"],"created_at":"2024-10-06T08:12:15.729Z","updated_at":"2025-07-23T15:07:32.310Z","avatar_url":"https://github.com/csgillespie.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput:\n  md_document:\n    variant: gfm\neditor_options:\n  chunk_output_type: console\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# API to typeform data sets\n[![Build Status](https://app.travis-ci.com/csgillespie/rtypeform.svg?branch=master)](https://app.travis-ci.com/csgillespie/rtypeform)\n[![Downloads](https://cranlogs.r-pkg.org/badges/rtypeform?color=brightgreen)](https://cran.r-project.org/package=rtypeform)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/rtypeform)](https://cran.r-project.org/package=rtypeform)\n[![codecov.io](https://codecov.io/github/csgillespie/rtypeform/coverage.svg?branch=master)](https://app.codecov.io/github/csgillespie/rtypeform?branch=master)\n[![R-CMD-check](https://github.com/csgillespie/rtypeform/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/csgillespie/rtypeform/actions/workflows/R-CMD-check.yaml)\n\n[Typeform](https://www.typeform.com) is a company that specializes in online form building.\nThis R package allows users to download their form results through the exposed API (V2).\n\n## Installation\n\nThe package can be installed from CRAN\n\n```{r eval=FALSE}\ninstall.packages(\"rtypeform\")\n```\n\nand loaded in the usual way.\n\n```{r}\nlibrary(\"rtypeform\")\n```\n\n## Using this package\n\nThis package can be used with either a typeform personal access token __or__\nby setting up an application and creating an OAuth access token.\n\nA personal access token gives you full access to all of the typeform API for your typeforms and results. Note anyone with your personal access token can retrieve, update and delete your typeforms and data. To access your typeform data with a personal access token see the [Personal Access Token](#pat) section below.\n\nWhen creating an application with an OAuth access token, explicit permission for different functionality (scopes) must be granted. See the section below on [OAuth access](#oauth).\n\nIf you have previously used the version 1 API this is now entirely removed. You will need\nto generate new tokens.\n\n### Personal Access Token {#pat}\n\nTo use this package with a personal access token you need to first obtain one. It is fairly easy to obtain one.\nSee typeform's [help page](https://www.typeform.com/developers/get-started/personal-access-token/). The\ntoken will look something like\n\n\u003e 943af478d3ff3d4d760020c11af102b79c440513\n\n### OAuth Access {#oauth}\n\nWhen you create an application that authenticates using OAuth you will use scopes to define the extent of access to a users data. This way your app can request a users permission to undertake actions on that users behalf.\n\n[This link](https://www.typeform.com/developers/get-started/applications/) will get you started with registering a new application on your account.\n\nOnce you have your client id and client secret you can use the {rtypeform} package to set these as options.\n\n```{r, eval = FALSE}\nrtypeform_set_client_id(my_client_id)\nrtypeform_set_client_secret(my_client_secret)\n```\n\nAs with the personal access token. Anyone with these details can impersonate you to obtain, update and remove data, they should always be kept safe.\n\nHaving set the client id and secret, before we can obtain an access token we also need to define the scope of our application. `rtypeform_set_scope()` takes as argument a character vector of allowed access scopes. For more information see the scopes section below.\n\n```{r, eval = FALSE}\nrtypeform_set_scope(\"forms:read\")\n```\n\nWe can then generate a new token with\n\n```{r, eval = FALSE}\napi = make_new_token()\n```\n\nThis will open a web browser prompting the user to give permission. The token can be cached in a local .httr-oauth file between sessions.\n\n### Scopes\n\nYou define the scope at the time that the access token is generated. To discover what each scope allows access to, see [here](https://www.typeform.com/developers/get-started/scopes/).\n\n## Using the package\n\nOnce you have this key, (either personal access token, or an oauth token created by `make_new_token()`) we can extract data from typeform\n\n```{r, echo = -2}\napi = \"XXXXX\"\napi = get_api()\n# Was get_typeforms() in V1 of the package\nforms = get_forms(api)\n```\n\nThe forms object is also contains attributes containing the total number of\nforms.\n\n```{r}\nattr(forms, \"total_items\")\n```\n\nIf you don't pass your `api` token as an argument, it will attempt to read the variable\n`typeform_api2` from your `.Renviron` file, via `Sys.getenv(\"typeform_api2\")`. If\nthis variable is set correctly, then you can __omit__ the `api` argument\n\n```{r}\n# See ?get_forms for further details\nforms = get_forms()\n```\n\nTo set the access token for the current session you can use\n\n```{r, eval = FALSE}\nrtypeform_set_token(api)\n```\nset (see Efficient R programming [Chapter 2](https://csgillespie.github.io/efficientR/set-up.html#renviron) for\nmore details).\n\nYou can download data from a particular typeform via\n```{r}\n# Most recent typeform\nform_id = forms$form_id[1]\nq = get_responses(form_id, completed = TRUE)\n```\n\nThe object `q` is a list. The first element is `meta` that contain details on\nthe user, such as, their `platform` and `user_agent`. The other list elements are\nresponses to each question.\n\nThere are a number of options for downloading the data. For example\n\n```{r}\nq = get_responses(form_id, completed = TRUE, page_size = 100)\n```\n\nSee the `?get_responses` help page for other options.\n\n### Looking at the responses\n\nSince the responses is list, we get to perform lots of map operations. I find using\n{purrr} and the {tidyverse} make this a bit easier. To see the question types we\ncan use string a few `map()` commands together\n```{r eval=FALSE}\nlibrary(\"tidyverse\")\nquestion_types = q[-1] %\u003e% # Remove the meta\n   map(~select(.x, type)) %\u003e%\n   map_df(~slice(.x, 1)) %\u003e%\n   pull()\n```\n\n### Example: Multiple Filters / Order\n\nImagine we only want:\n\n  * completed results, so we add the parameter `completed = TRUE`.\n  * a maximum of 5 results, so we add the parameter `page_size = 5`.\n  * results since `2018-01-01 11:00:00`.\n\n```{r eval=FALSE}\nsince = \"2018-01-01 11:00:00\"\n# convert to date-time\nsince = lubridate::ymd_hms(since)\nq = get_responses(form_id, completed = TRUE,\n                  page_size = 5, since = since)\n```\n\n## Other information\n\n * If you have any suggestions or find bugs, please use the github [issue tracker](https://github.com/csgillespie/rtypeform/issues).\n * Feel free to submit pull requests.\n\n---\n\nDevelopment of this package was supported by [Jumping Rivers](https://www.jumpingrivers.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsgillespie%2Frtypeform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsgillespie%2Frtypeform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsgillespie%2Frtypeform/lists"}