Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dtinth/event-popper
💢 A serverless endpoint (via Netlify Functions) to allow programmatic deployment of event description pages in Eventpop.
https://github.com/dtinth/event-popper
netlify netlify-functions
Last synced: 2 months ago
JSON representation
💢 A serverless endpoint (via Netlify Functions) to allow programmatic deployment of event description pages in Eventpop.
- Host: GitHub
- URL: https://github.com/dtinth/event-popper
- Owner: dtinth
- Created: 2019-02-28T11:36:56.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-16T11:32:41.000Z (almost 2 years ago)
- Last Synced: 2024-05-02T06:07:07.681Z (9 months ago)
- Topics: netlify, netlify-functions
- Language: JavaScript
- Homepage:
- Size: 721 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# event-popper
A Node.js package and a deployable REST API to update Eventpop event
description programmatically.This can be useful for, e.g. continuously deploying an Eventpop description
page from a Git repository. For example,
[global diversity CFP day (Bangkok 2019)’s Eventpop page](https://www.eventpop.me/e/5302-global-diversity-cfp-day-bangkok-2019)
was
[generated using React](https://gitlab.com/dtinth/gdcd-2019-bangkok/blob/master/EventPop-Description.html)
and
[continuously deployed using GitLab CI](https://gitlab.com/dtinth/gdcd-2019-bangkok/blob/master/.gitlab-ci.yml).## Disclaimer
This project is not affiliated with or endorsed by Eventpop. I just kinda
reverse-engineered the HTTP requests to make it easier for developers (and
outside contributors) to update the event description page, even if they don’t
have access to Eventpop’s organizer system. Do not abuse, and USE IT AT YOUR
OWN RISK. No support is provided, although contributions are welcome.## Preparation
To use this you need to find your _organizer ID_, _event ID_ and _session ID_.
1. **Sign in to Eventpop organizer account** and **go to an event dashboard.**
You should have the URL in this form:```
https://www.eventpop.me/organizers//events/-*
```2. **Open your dev tools** and **extract the cookie called
`_stampmein_session`** from your browser. This is your _session ID_. Protect
this ID as anyone who has it can impersonate you!## REST API
Using a REST API is a useful and more secure method that offers protection of
your _session ID_.If your session ID fell into a wrong hand, it can be used to do _anything_ to
every event that you have access to. It can also be used to buy tickets on your
behalf. This REST API only allows updating the description of a single event
using an API key, hiding your session ID.1. **Deploy the API to Netlify** by clicking this button:
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/dtinth/event-popper)
In **Configure your site** step, enter:
- **API Key** — put in some random string here to protect the endpoint. You
need this API key to call it. For example:
`4122c643d4fc3af51fd9e42b6d59e6a9412bc0bd`
- **Eventpop Organizer ID** — obtain from organizer URL [optional]
- **Eventpop Event ID** — obtain from organizer URL [optional]
- **Eventpop Session ID** — obtain this from the browser cookie named
`_stampmein_session`2. **Once deployed, you can call the API.** Here’s an example using
[HTTPie](https://httpie.org/):- **Update event on the configured event** — just pass in the API key normally.
```
http post https://______.netlify.com/.netlify/functions/updateEventDescription \
apiKey=4122c643d4fc3af51fd9e42b6d59e6a9412bc0bd \
description=TEST
```Use this method if you plan to use `event-popper` with just a single event.
- **Update event on a specific event** — generate a HS256 JWT with `eventId` claim use the `API_KEY` as a secret.
![](./docs/images/jwt.png)
Then use the resulting JWT as an `apiKey`:
```
http post https://______.netlify.com/.netlify/functions/updateEventDescription \
apiKey=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJldmVudElkIjoiMTIzNCJ9.y3a5Dik9vLuNxIkyMRGUWIogELckfgLhT-k5GVE5Xuo \
description=TEST
```Use this method if you plan to use `event-popper` with multiple events.
3. **After a while the session may expire.** You need to go to Netlify’s project
**Settings** → **Build & deploy** → **Build environment variables**
→ **`EVENTPOP_SESSION_ID`** and replace it with a new session ID.## Node.js API
_Note: This module is not published to npm yet._
### updateEventDescription(html, config)
Updates an event’s description.
### config
An object with 3 properties:
- `organizerId` (`number`) your organization ID
- `eventId` (`number`) your event ID
- `sessionId` (`string`) your event pop organizer session ID, get from cookie
named `_stampmein_session`