@octree/piece-decidim
v0.0.1
Published
<h1 align="center"><img src="./src/logo.svg" alt="Decidim ActivePiece - Integrate Decidim with Activepieces" /></h1> <h4 align="center"> <a href="https://voca.city">Voca.city</a> | <a href="https://decidim.org">Decidim</a> | <a href="https://d
Readme
Decidim ActivePiece
This piece interacts with Decidim using the decidim-restfull module.
Prerequisites
Ensure you have the correct Node.js version installed. Run nvm use to use the version specified in the project (see .nvmrc).
Setup
Starting Decidim
- Run
docker-composeto start a Decidim container. - Compile assets:
bin/compile-assets - Start the Rails server:
bundle exec rails s -b 0.0.0.0 - Start the asset server:
bundle exec bin/shakapacker-dev-server - Seed the database:
bundle exec rails db:seed
Decidim is exposed at port 3001.
System Configuration
- Navigate to
/systemwith default credentials:- Email:
[email protected] - Password:
decidim123456789
- Email:
- Add a "Client API" for the created organization, and check scopes and permissions.
- Set the host to
pieces.localhostin the system settings (organization edition).
Development
- Export the piece you want to work on:
export AP_DEV_PIECES=store,decidim - Start the development server:
npm start
Connection Configuration
The Decidim connection requires:
client_id/client_secret: From the Client API created in/system- Base URL:
http://pieces.localhost:3001
Building
Run npx nx build pieces-decidim to build the library. The build is done in a github workflow to have tarball exported at each versions.
Version are managed in packages/pieces/community/decidim/package.json
Running unit tests
Run npx nx test pieces-decidim to execute the unit tests via jest.
Features
🧩 Impersonate
Get an access token to perform actions as a participant in Decidim.
Inputs:
username(required): The nickname of the user to impersonate (minimum 5 characters)fetchUserInfo(optional): If enabled, fetches user information from the Decidim APIregisterOnMissing(optional): If enabled, registers the user if they don't existregistrationOptions(optional, shown whenregisterOnMissingis enabled):userFullName(optional): Full name of the user to register (minimum 5 characters)sendConfirmationEmailOnRegister(optional): If enabled, sends a confirmation email to the user
Outputs:
token: OAuth access token object containingaccess_token,token_type,expires_in,refresh_token, andscopeuser: User resource details (only iffetchUserInfois enabled)
🧩 Participant Management
Manage Decidim participants with Search, Create, Read, Update operations.
Search
Search participants by extended data query.
Inputs:
extendedDataQuery(required): JSON string to search in extended_data (e.g.,'{"chatbotUserId": "123"}')
Outputs:
users: Array of matching user objectscount: Number of users found
Create
Create a new participant or find an existing one by username. If the user exists, returns an impersonate token. If not, creates the user and returns an impersonate token.
Inputs:
username(required): Nickname of the useruserFullName(optional): Full name of the useremail(optional): Email address for the userextendedData(optional): Extended data object to set (e.g.,{"chatbotUserId": "123"})fetchUserInfo(optional): If enabled, fetches user information after creation
Outputs:
token: OAuth impersonate access token objectuserId: Decidim user IDuser: User resource details (only iffetchUserInfois enabled)
Read
Read participant data including extended data and user information.
Inputs:
userId(required): Decidim user ID
Outputs:
userId: Decidim user IDdata: Extended data object (null if not set)user: User resource details
Update
Update participant extended data.
Inputs:
userId(required): Decidim user IDextendedData(required): Extended data object to update (e.g.,{"chatbotUserId": "123"})dataPath(optional): Path in extended_data to update (defaults to".")
Outputs:
userId: Decidim user IDdata: Updated extended data object
