decidim-chatbot 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. checksums.yaml +7 -0
  2. data/.erb_lint.yml +2134 -0
  3. data/.github/workflows/website.yml +57 -0
  4. data/.gitignore +13 -0
  5. data/.gitlab-ci.yml +204 -0
  6. data/.node-version +1 -0
  7. data/.nvmrc +1 -0
  8. data/.rspec +2 -0
  9. data/.rubocop.yml +17 -0
  10. data/.ruby-version +1 -0
  11. data/.simplecov +36 -0
  12. data/CONTRIBUTING.md +54 -0
  13. data/Gemfile +50 -0
  14. data/Gemfile.lock +1013 -0
  15. data/LICENSE.md +661 -0
  16. data/README.md +62 -0
  17. data/Rakefile +54 -0
  18. data/app/commands/decidim/chatbot/admin/destroy_item.rb +25 -0
  19. data/app/commands/decidim/chatbot/admin/menu_items/update_exit.rb +12 -0
  20. data/app/commands/decidim/chatbot/admin/menu_items/update_login.rb +12 -0
  21. data/app/commands/decidim/chatbot/admin/menu_items/update_propose_proposals.rb +12 -0
  22. data/app/commands/decidim/chatbot/admin/menu_items/update_read_blogs.rb +12 -0
  23. data/app/commands/decidim/chatbot/admin/menu_items/update_read_proposals.rb +12 -0
  24. data/app/commands/decidim/chatbot/admin/menu_items/update_vote_on_proposal.rb +12 -0
  25. data/app/commands/decidim/chatbot/admin/notifications/update_manual.rb +12 -0
  26. data/app/commands/decidim/chatbot/admin/notifications/update_phase.rb +12 -0
  27. data/app/commands/decidim/chatbot/admin/persist_item.rb +47 -0
  28. data/app/commands/decidim/chatbot/admin/reorder_items.rb +51 -0
  29. data/app/commands/decidim/chatbot/admin/send_test_notification.rb +74 -0
  30. data/app/commands/decidim/chatbot/admin/unsubscribe_user.rb +35 -0
  31. data/app/commands/decidim/chatbot/admin/update_chatbot.rb +17 -0
  32. data/app/commands/decidim/chatbot/notifications/deliver.rb +30 -0
  33. data/app/commands/decidim/chatbot/notifications/enqueue_phase.rb +67 -0
  34. data/app/commands/decidim/chatbot/notifications/send.rb +115 -0
  35. data/app/commands/decidim/chatbot/whatsapp/create_from_phone.rb +95 -0
  36. data/app/commands/decidim/chatbot/whatsapp/sync_phone.rb +56 -0
  37. data/app/controllers/decidim/api/rest_full/chatbot/base_controller.rb +52 -0
  38. data/app/controllers/decidim/api/rest_full/chatbot/chatbot_menu_items_controller.rb +49 -0
  39. data/app/controllers/decidim/api/rest_full/chatbot/chatbot_users_controller.rb +46 -0
  40. data/app/controllers/decidim/api/rest_full/chatbot/chatbots_controller.rb +40 -0
  41. data/app/controllers/decidim/chatbot/admin/chatbot_edit.rb +85 -0
  42. data/app/controllers/decidim/chatbot/admin/chatbots/generals_controller.rb +43 -0
  43. data/app/controllers/decidim/chatbot/admin/chatbots/menu_items_controller.rb +32 -0
  44. data/app/controllers/decidim/chatbot/admin/chatbots/notifications_controller.rb +92 -0
  45. data/app/controllers/decidim/chatbot/admin/chatbots/users/filterable.rb +33 -0
  46. data/app/controllers/decidim/chatbot/admin/chatbots/users_controller.rb +53 -0
  47. data/app/controllers/decidim/chatbot/admin/chatbots/whatsapps_controller.rb +59 -0
  48. data/app/controllers/decidim/chatbot/admin/chatbots_controller.rb +20 -0
  49. data/app/controllers/decidim/chatbot/admin/items_crud.rb +183 -0
  50. data/app/forms/decidim/chatbot/admin/chatbot_form.rb +20 -0
  51. data/app/forms/decidim/chatbot/admin/config_form.rb +20 -0
  52. data/app/forms/decidim/chatbot/admin/menu_item_form.rb +80 -0
  53. data/app/forms/decidim/chatbot/admin/menu_items/component_id_form.rb +60 -0
  54. data/app/forms/decidim/chatbot/admin/menu_items/exit_form.rb +24 -0
  55. data/app/forms/decidim/chatbot/admin/menu_items/login_form.rb +35 -0
  56. data/app/forms/decidim/chatbot/admin/menu_items/propose_proposals_form.rb +23 -0
  57. data/app/forms/decidim/chatbot/admin/menu_items/propose_proposals_labels.rb +53 -0
  58. data/app/forms/decidim/chatbot/admin/menu_items/read_blogs_form.rb +23 -0
  59. data/app/forms/decidim/chatbot/admin/menu_items/read_content_labels.rb +51 -0
  60. data/app/forms/decidim/chatbot/admin/menu_items/read_proposals_form.rb +23 -0
  61. data/app/forms/decidim/chatbot/admin/menu_items/vote_on_proposal_form.rb +123 -0
  62. data/app/forms/decidim/chatbot/admin/notification_item_form.rb +111 -0
  63. data/app/forms/decidim/chatbot/admin/notifications/manual_form.rb +13 -0
  64. data/app/forms/decidim/chatbot/admin/notifications/phase_form.rb +79 -0
  65. data/app/forms/decidim/chatbot/admin/notifications/template_fields.rb +60 -0
  66. data/app/forms/decidim/chatbot/admin/notifications/test_form.rb +179 -0
  67. data/app/helpers/decidim/chatbot/admin/items_helper.rb +44 -0
  68. data/app/jobs/decidim/chatbot/chatbot_webhook_job.rb +59 -0
  69. data/app/jobs/decidim/chatbot/send_notification_job.rb +33 -0
  70. data/app/models/decidim/chatbot/chatbot.rb +47 -0
  71. data/app/models/decidim/chatbot/item.rb +99 -0
  72. data/app/packs/.keep +0 -0
  73. data/app/presenters/decidim/chatbot/admin_log/chatbot_presenter.rb +42 -0
  74. data/app/presenters/decidim/chatbot/admin_log/item_presenter.rb +32 -0
  75. data/app/queries/decidim/chatbot/admin/proposal_vote_mode.rb +41 -0
  76. data/app/queries/decidim/chatbot/whatsapp_users.rb +58 -0
  77. data/app/serializers/decidim/api/rest_full/chatbot/chatbot_menu_item_serializer.rb +113 -0
  78. data/app/serializers/decidim/api/rest_full/chatbot/chatbot_notification_serializer.rb +19 -0
  79. data/app/serializers/decidim/api/rest_full/chatbot/chatbot_serializer.rb +66 -0
  80. data/app/serializers/decidim/api/rest_full/chatbot/chatbot_user_identity_serializer.rb +23 -0
  81. data/app/serializers/decidim/api/rest_full/chatbot/chatbot_user_serializer.rb +28 -0
  82. data/app/serializers/decidim/api/rest_full/chatbot/chatbot_webhook_serializer.rb +21 -0
  83. data/app/services/decidim/chatbot/chatbot_webhook_handler.rb +40 -0
  84. data/app/services/decidim/chatbot/notifications/bindings.rb +87 -0
  85. data/app/services/decidim/chatbot/whatsapp/body_parameters.rb +29 -0
  86. data/app/services/decidim/chatbot/whatsapp/graph_client.rb +136 -0
  87. data/app/services/decidim/chatbot/whatsapp/status_mapper.rb +93 -0
  88. data/app/services/decidim/chatbot/whatsapp/template_manager_url.rb +35 -0
  89. data/app/views/decidim/chatbot/admin/chatbots/generals/_menu_preview.html.erb +49 -0
  90. data/app/views/decidim/chatbot/admin/chatbots/generals/edit.html.erb +79 -0
  91. data/app/views/decidim/chatbot/admin/chatbots/index.html.erb +50 -0
  92. data/app/views/decidim/chatbot/admin/chatbots/menu_items/_form.html.erb +2 -0
  93. data/app/views/decidim/chatbot/admin/chatbots/menu_items/edit.html.erb +2 -0
  94. data/app/views/decidim/chatbot/admin/chatbots/menu_items/index.html.erb +43 -0
  95. data/app/views/decidim/chatbot/admin/chatbots/menu_items/new.html.erb +12 -0
  96. data/app/views/decidim/chatbot/admin/chatbots/notifications/_form.html.erb +4 -0
  97. data/app/views/decidim/chatbot/admin/chatbots/notifications/_manual_fields.html.erb +8 -0
  98. data/app/views/decidim/chatbot/admin/chatbots/notifications/_phase_fields.html.erb +6 -0
  99. data/app/views/decidim/chatbot/admin/chatbots/notifications/edit.html.erb +3 -0
  100. data/app/views/decidim/chatbot/admin/chatbots/notifications/index.html.erb +40 -0
  101. data/app/views/decidim/chatbot/admin/chatbots/notifications/new.html.erb +11 -0
  102. data/app/views/decidim/chatbot/admin/chatbots/notifications/test.html.erb +35 -0
  103. data/app/views/decidim/chatbot/admin/chatbots/tabs/_whatsapp.html.erb +47 -0
  104. data/app/views/decidim/chatbot/admin/chatbots/users/_filters.html.erb +23 -0
  105. data/app/views/decidim/chatbot/admin/chatbots/users/index.html.erb +56 -0
  106. data/app/views/decidim/chatbot/admin/chatbots/whatsapps/show.html.erb +5 -0
  107. data/app/views/decidim/chatbot/admin/shared/_item_form.html.erb +64 -0
  108. data/app/views/decidim/chatbot/admin/shared/_row_actions.html.erb +28 -0
  109. data/app/views/decidim/chatbot/admin/shared/_tabs_menu.html.erb +13 -0
  110. data/app/views/decidim/chatbot/admin/shared/_type_fields.html.erb +2 -0
  111. data/app/views/decidim/chatbot/admin/shared/_type_picker.html.erb +15 -0
  112. data/app/views/decidim/chatbot/admin/shared/type_fields/_component_id.html.erb +9 -0
  113. data/app/views/decidim/chatbot/admin/shared/type_fields/_exit.html.erb +5 -0
  114. data/app/views/decidim/chatbot/admin/shared/type_fields/_login.html.erb +8 -0
  115. data/app/views/decidim/chatbot/admin/shared/type_fields/_manual.html.erb +16 -0
  116. data/app/views/decidim/chatbot/admin/shared/type_fields/_phase.html.erb +46 -0
  117. data/app/views/decidim/chatbot/admin/shared/type_fields/_propose_proposals.html.erb +10 -0
  118. data/app/views/decidim/chatbot/admin/shared/type_fields/_read_blogs.html.erb +16 -0
  119. data/app/views/decidim/chatbot/admin/shared/type_fields/_read_proposals.html.erb +16 -0
  120. data/app/views/decidim/chatbot/admin/shared/type_fields/_vote_on_proposal.html.erb +26 -0
  121. data/app/views/decidim/chatbot/admin/shared/type_fields/vote/_shows_abstention_label.html.erb +7 -0
  122. data/app/views/decidim/chatbot/admin/shared/type_fields/vote/_shows_vote_label.html.erb +7 -0
  123. data/app/views/decidim/chatbot/admin/shared/type_fields/vote/_shows_votes_closed_warning.html.erb +6 -0
  124. data/app/views/decidim/chatbot/admin/shared/type_fields/vote/_shows_weight_labels.html.erb +15 -0
  125. data/bin/check +13 -0
  126. data/bin/ci-setup +38 -0
  127. data/bin/gen-node-client +112 -0
  128. data/bin/gen-openapi +248 -0
  129. data/bin/i18n-tasks +27 -0
  130. data/bin/postversion +17 -0
  131. data/config/i18n-tasks.yml +38 -0
  132. data/config/locales/decidim_chatbot.en.yml +323 -0
  133. data/config/locales/decidim_chatbot.fr.yml +29 -0
  134. data/contrib/decidim-node-client/.gitignore +4 -0
  135. data/contrib/decidim-node-client/.npmignore +1 -0
  136. data/contrib/decidim-node-client/.openapi-generator/FILES +8 -0
  137. data/contrib/decidim-node-client/.openapi-generator/VERSION +1 -0
  138. data/contrib/decidim-node-client/.openapi-generator-ignore +13 -0
  139. data/contrib/decidim-node-client/.yarnrc.yml +5 -0
  140. data/contrib/decidim-node-client/README.md +37 -0
  141. data/contrib/decidim-node-client/api.ts +14193 -0
  142. data/contrib/decidim-node-client/base.ts +70 -0
  143. data/contrib/decidim-node-client/common.ts +185 -0
  144. data/contrib/decidim-node-client/configuration.ts +138 -0
  145. data/contrib/decidim-node-client/git_push.sh +57 -0
  146. data/contrib/decidim-node-client/index.ts +16 -0
  147. data/contrib/decidim-node-client/package.json +49 -0
  148. data/contrib/decidim-node-client/packup.config.ts +7 -0
  149. data/contrib/decidim-node-client/tsconfig.json +25 -0
  150. data/contrib/decidim-node-client/yarn.lock +2367 -0
  151. data/crowdin.yml +15 -0
  152. data/db/migrate/20260725120000_create_decidim_chatbot_chatbots.rb +20 -0
  153. data/db/migrate/20260822120000_create_decidim_chatbot_items.rb +20 -0
  154. data/db/migrate/20260824120000_add_menu_and_error_copy_to_decidim_chatbot_chatbots.rb +13 -0
  155. data/db/migrate/20260824140000_add_enabled_to_decidim_chatbot_items.rb +7 -0
  156. data/decidim-chatbot.gemspec +40 -0
  157. data/docker-compose.ci.yml +59 -0
  158. data/docker-compose.yml +47 -0
  159. data/lib/decidim/chatbot/admin_engine.rb +67 -0
  160. data/lib/decidim/chatbot/admin_menu.rb +41 -0
  161. data/lib/decidim/chatbot/default_manifests.rb +91 -0
  162. data/lib/decidim/chatbot/engine.rb +107 -0
  163. data/lib/decidim/chatbot/manifest.rb +31 -0
  164. data/lib/decidim/chatbot/menu_item_label_keys.rb +26 -0
  165. data/lib/decidim/chatbot/registry.rb +42 -0
  166. data/lib/decidim/chatbot/rest_full_ability.rb +24 -0
  167. data/lib/decidim/chatbot/settings_tab.rb +18 -0
  168. data/lib/decidim/chatbot/test_definitions.rb +352 -0
  169. data/lib/decidim/chatbot/variable_interpolator.rb +30 -0
  170. data/lib/decidim/chatbot/version.rb +21 -0
  171. data/lib/decidim/chatbot/webhook_publisher.rb +29 -0
  172. data/lib/decidim/chatbot.rb +41 -0
  173. data/lib/decidim-chatbot.rb +3 -0
  174. data/lib/tasks/chatbot.rake +64 -0
  175. data/openapi/openapi.json +37801 -0
  176. data/openapitools.json +7 -0
  177. data/package.json +22 -0
  178. data/prettier.config.js +15 -0
  179. data/spec/commands/decidim/chatbot/admin/destroy_item_spec.rb +24 -0
  180. data/spec/commands/decidim/chatbot/admin/persist_item_spec.rb +80 -0
  181. data/spec/commands/decidim/chatbot/admin/reorder_items_spec.rb +53 -0
  182. data/spec/commands/decidim/chatbot/admin/send_test_notification_spec.rb +105 -0
  183. data/spec/commands/decidim/chatbot/admin/unsubscribe_user_spec.rb +46 -0
  184. data/spec/commands/decidim/chatbot/admin/update_chatbot_spec.rb +56 -0
  185. data/spec/commands/decidim/chatbot/notifications/enqueue_phase_spec.rb +59 -0
  186. data/spec/commands/decidim/chatbot/notifications/send_spec.rb +101 -0
  187. data/spec/commands/decidim/chatbot/whatsapp/create_from_phone_spec.rb +122 -0
  188. data/spec/commands/decidim/chatbot/whatsapp/sync_phone_spec.rb +110 -0
  189. data/spec/controllers/decidim/chatbot/admin/chatbots_controller_spec.rb +25 -0
  190. data/spec/factories/chatbot.rb +44 -0
  191. data/spec/forms/decidim/chatbot/admin/chatbot_form_spec.rb +41 -0
  192. data/spec/forms/decidim/chatbot/admin/config_form_spec.rb +30 -0
  193. data/spec/forms/decidim/chatbot/admin/menu_item_form_spec.rb +49 -0
  194. data/spec/forms/decidim/chatbot/admin/menu_items/component_id_form_spec.rb +54 -0
  195. data/spec/forms/decidim/chatbot/admin/menu_items/component_id_forms_spec.rb +512 -0
  196. data/spec/forms/decidim/chatbot/admin/menu_items/exit_form_spec.rb +39 -0
  197. data/spec/forms/decidim/chatbot/admin/menu_items/login_form_spec.rb +101 -0
  198. data/spec/forms/decidim/chatbot/admin/menu_items/propose_proposals_form_prefill_spec.rb +26 -0
  199. data/spec/forms/decidim/chatbot/admin/menu_items/read_blogs_form_prefill_spec.rb +22 -0
  200. data/spec/forms/decidim/chatbot/admin/notifications/manual_form_spec.rb +130 -0
  201. data/spec/forms/decidim/chatbot/admin/notifications/phase_form_spec.rb +79 -0
  202. data/spec/forms/decidim/chatbot/admin/notifications/test_form_spec.rb +172 -0
  203. data/spec/jobs/decidim/chatbot/chatbot_webhook_job_spec.rb +47 -0
  204. data/spec/jobs/decidim/chatbot/send_notification_job_spec.rb +53 -0
  205. data/spec/lib/decidim/chatbot/engine_spec.rb +44 -0
  206. data/spec/lib/decidim/chatbot/registry_spec.rb +30 -0
  207. data/spec/lib/decidim/chatbot/settings_tab_spec.rb +21 -0
  208. data/spec/lib/decidim/chatbot/variable_interpolator_spec.rb +34 -0
  209. data/spec/lib/decidim/chatbot/whatsapp/status_mapper_spec.rb +64 -0
  210. data/spec/lib/decidim/chatbot_spec.rb +59 -0
  211. data/spec/models/decidim/chatbot/chatbot_spec.rb +23 -0
  212. data/spec/models/decidim/chatbot/item_spec.rb +88 -0
  213. data/spec/presenters/decidim/chatbot/admin_log/chatbot_presenter_spec.rb +64 -0
  214. data/spec/queries/decidim/chatbot/admin/proposal_vote_mode_spec.rb +74 -0
  215. data/spec/queries/decidim/chatbot/whatsapp_users_spec.rb +57 -0
  216. data/spec/requests/decidim/api/rest_full/chatbot/chatbot_menu_items_controller_spec.rb +344 -0
  217. data/spec/requests/decidim/api/rest_full/chatbot/chatbot_users_controller_spec.rb +140 -0
  218. data/spec/requests/decidim/api/rest_full/chatbot/chatbots_controller_spec.rb +195 -0
  219. data/spec/requests/decidim/chatbot/admin/chatbots/notifications_controller_spec.rb +44 -0
  220. data/spec/requests/decidim/chatbot/admin/tenant_isolation_spec.rb +133 -0
  221. data/spec/requests/decidim/chatbot/admin/unsubscribe_user_spec.rb +28 -0
  222. data/spec/serializers/decidim/api/rest_full/chatbot/chatbot_menu_item_serializer_spec.rb +321 -0
  223. data/spec/serializers/decidim/api/rest_full/chatbot/chatbot_serializer_spec.rb +49 -0
  224. data/spec/serializers/decidim/api/rest_full/chatbot/chatbot_user_serializer_spec.rb +40 -0
  225. data/spec/services/decidim/chatbot/chatbot_webhook_handler_spec.rb +43 -0
  226. data/spec/services/decidim/chatbot/notifications/bindings_spec.rb +86 -0
  227. data/spec/services/decidim/chatbot/whatsapp/body_parameters_spec.rb +22 -0
  228. data/spec/services/decidim/chatbot/whatsapp/graph_client_spec.rb +205 -0
  229. data/spec/services/decidim/chatbot/whatsapp/template_manager_url_spec.rb +33 -0
  230. data/spec/spec_helper.rb +33 -0
  231. data/spec/support/allow_all_hosts.rb +9 -0
  232. data/spec/support/chatbot_admin.rb +16 -0
  233. data/spec/support/decidim_factories.rb +7 -0
  234. data/spec/support/decidim_system_factories.rb +3 -0
  235. data/spec/support/devise.rb +5 -0
  236. data/spec/support/rack_test_system_driver.rb +43 -0
  237. data/spec/support/whatsapp_graph.rb +15 -0
  238. data/spec/swagger_helper.rb +47 -0
  239. data/spec/system/decidim/chatbot/admin/admin_can_send_manual_when_ready_spec.rb +35 -0
  240. data/spec/system/decidim/chatbot/admin/admin_configures_vote_on_proposal_menu_item_spec.rb +84 -0
  241. data/spec/system/decidim/chatbot/admin/admin_confirms_send_now_recipient_count_spec.rb +40 -0
  242. data/spec/system/decidim/chatbot/admin/admin_creates_menu_item_with_demo_field_spec.rb +65 -0
  243. data/spec/system/decidim/chatbot/admin/admin_creates_phase_and_manual_notifications_spec.rb +52 -0
  244. data/spec/system/decidim/chatbot/admin/admin_does_not_see_other_org_processes_in_phase_select_spec.rb +27 -0
  245. data/spec/system/decidim/chatbot/admin/admin_does_not_see_other_organization_chatbots_spec.rb +25 -0
  246. data/spec/system/decidim/chatbot/admin/admin_is_redirected_when_chatbot_is_disabled_spec.rb +28 -0
  247. data/spec/system/decidim/chatbot/admin/admin_lists_organization_chatbots_spec.rb +36 -0
  248. data/spec/system/decidim/chatbot/admin/admin_manual_notification_sends_with_nickname_spec.rb +68 -0
  249. data/spec/system/decidim/chatbot/admin/admin_navigates_chatbot_main_tabs_spec.rb +52 -0
  250. data/spec/system/decidim/chatbot/admin/admin_phase_notification_sends_on_step_change_spec.rb +79 -0
  251. data/spec/system/decidim/chatbot/admin/admin_picks_published_blog_component_spec.rb +205 -0
  252. data/spec/system/decidim/chatbot/admin/admin_picks_published_participatory_space_spec.rb +45 -0
  253. data/spec/system/decidim/chatbot/admin/admin_reorders_chatbot_menu_items_spec.rb +29 -0
  254. data/spec/system/decidim/chatbot/admin/admin_sees_disabled_menu_item_faded_on_the_table_spec.rb +23 -0
  255. data/spec/system/decidim/chatbot/admin/admin_sees_disabled_notification_item_faded_on_the_table_spec.rb +40 -0
  256. data/spec/system/decidim/chatbot/admin/admin_sees_notification_facts_and_frozen_template_name_spec.rb +71 -0
  257. data/spec/system/decidim/chatbot/admin/admin_sees_propose_proposals_defaults_prefilled_spec.rb +119 -0
  258. data/spec/system/decidim/chatbot/admin/admin_sees_type_specific_fields_spec.rb +89 -0
  259. data/spec/system/decidim/chatbot/admin/admin_sees_whatsapp_facts_and_can_sync_spec.rb +48 -0
  260. data/spec/system/decidim/chatbot/admin/admin_sees_whatsapp_template_edit_link_spec.rb +37 -0
  261. data/spec/system/decidim/chatbot/admin/admin_tests_notification_spec.rb +125 -0
  262. data/spec/system/decidim/chatbot/admin/admin_unchecks_enabled_on_a_menu_item_spec.rb +30 -0
  263. data/spec/system/decidim/chatbot/admin/admin_unsubscribes_whatsapp_user_from_chatbot_spec.rb +35 -0
  264. data/spec/system/decidim/chatbot/admin/admin_updates_welcome_message_from_general_tab_spec.rb +84 -0
  265. data/spec/system/decidim/chatbot/system/admin_updates_organization_chatbot_settings_spec.rb +33 -0
  266. data/spec/tasks/chatbot_create_spec.rb +99 -0
  267. data/spec/tasks/chatbot_sync_spec.rb +90 -0
  268. data/website/.node-version +1 -0
  269. data/website/.nvmrc +1 -0
  270. data/website/docs/developer/_category_.json +4 -0
  271. data/website/docs/developer/contribute.md +87 -0
  272. data/website/docs/index.md +42 -0
  273. data/website/docs/integrate/_category_.json +4 -0
  274. data/website/docs/integrate/index.md +214 -0
  275. data/website/docusaurus.config.ts +93 -0
  276. data/website/package.json +37 -0
  277. data/website/sidebars.ts +7 -0
  278. data/website/src/css/custom.css +37 -0
  279. data/website/static/api-docs.html +2218 -0
  280. data/website/static/img/logo.svg +1 -0
  281. data/website/static/openapi.json +37801 -0
  282. data/website/tsconfig.json +6 -0
  283. data/website/yarn.lock +9782 -0
  284. data/yarn.lock +1003 -0
  285. metadata +424 -0
@@ -0,0 +1,323 @@
1
+ ---
2
+ en:
3
+ activemodel:
4
+ attributes:
5
+ chatbot:
6
+ name: Name
7
+ welcome_message: Welcome message
8
+ menu_intro: Menu intro
9
+ menu_connector: Menu connector
10
+ error_404: Error 404
11
+ error_502: Error 502
12
+ error_401: Error 401
13
+ whatsapp_display_name: Display name
14
+ whatsapp_phone_number: Phone number
15
+ whatsapp_phone_status: Status
16
+ item:
17
+ enabled: Enabled
18
+ component_id: Component
19
+ introduction: Introduction
20
+ redirect_path: Redirect path
21
+ response_label: Response label
22
+ menu_button_label: Menu button label
23
+ menu_connector_label: Menu connector label
24
+ skip_menu_button: Skip menu button
25
+ read_more_button_label: Read more button label
26
+ nothing_to_read_label: Nothing to read label
27
+ default_title_label: Default title
28
+ body_label: Proposal prompt
29
+ verification_label: Confirmation intro
30
+ action_prompt_label: Action prompt
31
+ save_button_label: Save button
32
+ success_label: Success after save
33
+ withdraw_button_label: Withdraw button
34
+ withdraw_success_label: Success after withdraw
35
+ creation_not_enabled_label: Proposal creation not enabled warning
36
+ vote_label: Vote label
37
+ weight_1_label: Weight 1 label
38
+ weight_2_label: Weight 2 label
39
+ weight_3_label: Weight 3 label
40
+ abstention_label: Abstention label
41
+ participatory_process_id: Participatory process
42
+ participatory_space_gid: Participatory space
43
+ position: Position
44
+ template_id: Template ID
45
+ title: Title
46
+ variables_json: Variables
47
+ phase_variables: Variables list
48
+ use_space_name: "{{space_name}}"
49
+ use_phase_name: "{{phase_name}}"
50
+ use_phase_start: "{{phase_start}}"
51
+ use_phase_end: "{{phase_end}}"
52
+ test:
53
+ locale: Locale
54
+ phone_number: Phone number
55
+ step_id: Phase
56
+ decidim:
57
+ admin_log:
58
+ item:
59
+ send: "%{user_name} sent notification %{resource_name} to %{recipients_count} user(s), with %{failures_count} failure(s)."
60
+ chatbot:
61
+ create: "%{user_name} created chatbot %{resource_name}"
62
+ delete: "%{user_name} deleted chatbot %{resource_name}"
63
+ update: "%{user_name} updated chatbot %{resource_name}"
64
+ chatbot:
65
+ admin:
66
+ actions:
67
+ confirm_destroy: Are you sure you want to delete this item?
68
+ destroy: Delete
69
+ edit: Edit
70
+ test: Test
71
+ chatbots:
72
+ edit:
73
+ display_name: Display name
74
+ phone_id: Phone ID
75
+ phone_number: Phone number
76
+ save: Save
77
+ status: Status
78
+ synced_at: Last synced
79
+ synced_at_ago: "%{time} ago"
80
+ general:
81
+ basic_settings: Basic Settings
82
+ error_401_help: Shown when the user is not authorized.
83
+ error_404_help: Shown when a resource is not found.
84
+ error_502_help: Shown when an upstream service fails.
85
+ error_messages: Error Messages
86
+ menu: Menu
87
+ menu_connector_help: Shown between groups of three menu items.
88
+ menu_intro_help: Shown before the first group of menu items.
89
+ welcome_message_help: Set the welcome message participants see when they start
90
+ a conversation. The chatbot name is synced from WhatsApp.
91
+ index:
92
+ edit: Edit
93
+ empty_html: No chatbots assigned to this organization yet. Ask a system
94
+ administrator to create one.
95
+ headers:
96
+ actions: Actions
97
+ display_name: Display name
98
+ name: Name
99
+ phone_number: Phone number
100
+ status: Status
101
+ title: Chatbot
102
+ statuses:
103
+ blocked: Blocked
104
+ created: Created
105
+ ready: Ready
106
+ subscribed: Subscribed
107
+ waiting_2fa: Waiting 2FA
108
+ waiting_confirmation: Waiting confirmation
109
+ update:
110
+ error: There was a problem updating the chatbot.
111
+ success: Chatbot updated successfully.
112
+ whatsapp:
113
+ error: There was a problem talking to WhatsApp.
114
+ success: WhatsApp information updated successfully.
115
+ sync: Sync
116
+ disabled: Chatbot is disabled for this organization. Enable it under System
117
+ → Chatbot.
118
+ items:
119
+ add: Add
120
+ cancel: Cancel
121
+ new_menu_breadcrumb: New menu item
122
+ new_notification_breadcrumb: New notification
123
+ edit_menu_breadcrumb: Edit %{title}
124
+ edit_notification_breadcrumb: Edit %{template_id}
125
+ test_breadcrumb: Test notification
126
+ blog_component: Blog Component
127
+ choose_component: Choose a component
128
+ choose_phase: Choose a phase
129
+ choose_process: Choose a participatory process
130
+ choose_space: Choose a participatory space
131
+ choose_type_html: Choose an item type to add.
132
+ proposal_component: Proposal Component
133
+ new_menu_item: New %{type} menu item
134
+ new_notification_item: New %{type} notification
135
+ headers:
136
+ actions: Actions
137
+ template_id: Template ID
138
+ title: Title
139
+ type: Type
140
+ menu_empty_html: No menu items yet. Add one to get started.
141
+ notification_empty_html: No notification items yet. Add one to get started.
142
+ phone_number_help: International number with country code. Only this number receives the message.
143
+ test_locale_help: Organization locale. Selects which template ID and variables to use. WhatsApp template language comes from Meta for that ID.
144
+ redirect_path_help: Absolute path on this platform. Must start with / (for example /users/sign_in).
145
+ response_label_login_help: You can use {{login_url}} to place the login URL in the response label.
146
+ response_label_exit_help: Text shown when offboarding the user from notifications.
147
+ menu_button_label_read_blogs_help: Button to exit reading blogs and go back to the menu.
148
+ menu_button_label_read_proposals_help: Button to exit reading proposals and go back to the menu.
149
+ read_more_button_label_read_blogs_help: Button to read the next blog.
150
+ read_more_button_label_read_proposals_help: Button to read the next proposal.
151
+ nothing_to_read_label_read_blogs_help: Message shown when there are no blogs left to read.
152
+ nothing_to_read_label_read_proposals_help: Message shown when there are no proposals left to read.
153
+ nothing_to_read_label_read_blogs_default: There is nothing to read yet, come back later
154
+ nothing_to_read_label_read_proposals_default: There is no proposal yet, come back later
155
+ body_label_propose_proposals_help: Shown when asking the user to type the proposal
156
+ verification_label_propose_proposals_help: Shown just before the draft proposal text
157
+ action_prompt_label_propose_proposals_help: Shown after the draft, before Save / Withdraw
158
+ save_button_label_propose_proposals_help: Button to submit the proposal
159
+ success_label_propose_proposals_help: Shown after a successful submit
160
+ withdraw_button_label_propose_proposals_help: Button to cancel / withdraw the draft
161
+ withdraw_success_label_propose_proposals_help: Shown after the user withdraws
162
+ creation_not_enabled_label_propose_proposals_help: Shown when proposal creation is disabled on the component (for example after a phase change).
163
+ default_title_label_propose_proposals_help: Default proposal title. Use {{id}} to insert the proposal id.
164
+ title_blank_label_propose_proposals_help: Shown when the proposal title is blank.
165
+ body_blank_label_propose_proposals_help: Shown when the proposal body is blank.
166
+ title_must_start_with_caps_label_propose_proposals_help: Shown when the proposal title does not start with a capital letter.
167
+ body_must_start_with_caps_label_propose_proposals_help: Shown when the proposal body does not start with a capital letter.
168
+ title_too_much_caps_label_propose_proposals_help: Shown when the proposal title uses too many capital letters.
169
+ body_too_much_caps_label_propose_proposals_help: Shown when the proposal body uses too many capital letters.
170
+ title_too_short_label_propose_proposals_help: Shown when the proposal title is too short. Use %{count} for the minimum length.
171
+ body_too_short_label_propose_proposals_help: Shown when the proposal body is too short. Use %{count} for the minimum length.
172
+ title_too_long_label_propose_proposals_help: Shown when the proposal title is too long. Use %{count} for the maximum length.
173
+ body_too_long_label_propose_proposals_help: Shown when the proposal body is too long. Use %{count} for the maximum length.
174
+ title_too_many_marks_label_propose_proposals_help: Shown when the proposal title uses too many consecutive punctuation marks.
175
+ body_too_many_marks_label_propose_proposals_help: Shown when the proposal body uses too many consecutive punctuation marks.
176
+ body_label_propose_proposals_default: Please write your proposal
177
+ verification_label_propose_proposals_default: "Thanks, here is your proposal:"
178
+ action_prompt_label_propose_proposals_default: What do you want to do with the proposal?
179
+ save_button_label_propose_proposals_default: Save
180
+ success_label_propose_proposals_default: Your proposal has been submitted
181
+ withdraw_button_label_propose_proposals_default: Withdraw
182
+ withdraw_success_label_propose_proposals_default: Your proposal has been withdrawn
183
+ creation_not_enabled_label_propose_proposals_default: Proposal creation is not available right now, please come back later.
184
+ default_title_label_propose_proposals_default: "{{id}} Anonymous proposal"
185
+ title_blank_label_propose_proposals_default: cannot be blank
186
+ body_blank_label_propose_proposals_default: cannot be blank
187
+ title_must_start_with_caps_label_propose_proposals_default: must start with a capital letter
188
+ body_must_start_with_caps_label_propose_proposals_default: must start with a capital letter
189
+ title_too_much_caps_label_propose_proposals_default: is using too many capital letters (over 25% of the text)
190
+ body_too_much_caps_label_propose_proposals_default: is using too many capital letters (over 25% of the text)
191
+ title_too_short_label_propose_proposals_default: is too short (under %{count} characters)
192
+ body_too_short_label_propose_proposals_default: is too short (under %{count} characters)
193
+ title_too_long_label_propose_proposals_default: is too long (maximum is %{count} characters)
194
+ body_too_long_label_propose_proposals_default: is too long (maximum is %{count} characters)
195
+ title_too_many_marks_label_propose_proposals_default: is using too many consecutive punctuation marks (e.g. ! and ?)
196
+ body_too_many_marks_label_propose_proposals_default: is using too many consecutive punctuation marks (e.g. ! and ?)
197
+ votes_not_open_html: Voting is not open on this proposal component. Votes from the chatbot will probably fail until voting is enabled for the current phase.
198
+ vote_label_help: Button label for casting a simple vote.
199
+ weight_1_label_help: Button label for weight 1 (for example Disagree).
200
+ weight_2_label_help: Button label for weight 2 (for example Neutral).
201
+ weight_3_label_help: Button label for weight 3 (for example Agree).
202
+ abstention_label_help: Button label for abstaining from the vote.
203
+ action_prompt_label_vote_on_proposal_help: Intro text shown above the voting action menu.
204
+ menu_button_label_vote_on_proposal_help: Button to exit voting and go back to the menu.
205
+ menu_connector_label_vote_on_proposal_help: Shown when there are more than three voting menu items.
206
+ skip_menu_button_vote_on_proposal_help: Button labeled Skip when no abstention is defined.
207
+ send_button: Send
208
+ send_now_button: Send now
209
+ send_now_confirm:
210
+ one: Are you sure you want to notify %{count} subscribed user?
211
+ other: Are you sure you want to notify %{count} subscribed users?
212
+ test_heading: Test notification
213
+ template_id_help: Meta WhatsApp template ID (digits only). One ID per organization locale.
214
+ template_id_help_html: Meta WhatsApp template ID (digits only). One ID per organization locale. Must exist on %{link}.
215
+ message_templates: Message templates
216
+ template_meta_validation_help: Template modifications can take up to 3 days to be validated by Meta.
217
+ edit_template: Edit template in WhatsApp Manager
218
+ variables_help: "JSON object. Keys must be lowercase a-z and underscores only (Facebook named placeholders). Values may use %{organization_name}, %{chatbot_name}, %{user_name}, %{nickname}."
219
+ variables_list: Variables list
220
+ phase_variables:
221
+ space_name_html: use the variable <code>{{space_name}}</code> (e.g "Gather Together")
222
+ phase_name_html: use the variable <code>{{phase_name}}</code> (e.g "Introduction")
223
+ phase_start_html: use the variable <code>{{phase_start}}</code> (e.g "10/07/2026")
224
+ phase_end_html: use the variable <code>{{phase_end}}</code> (e.g "13/10/2026")
225
+ send:
226
+ error: The notification is not ready to send.
227
+ success: Notification queued to send.
228
+ test:
229
+ error: There was a problem sending the test notification.
230
+ success: Test notification sent.
231
+ update:
232
+ success: Item saved successfully.
233
+ manifests:
234
+ menu:
235
+ exit: Exit
236
+ exit_help: Unsubscribe from notification.
237
+ login: Login
238
+ login_help: Log in and redirect to some page.
239
+ propose_proposals: Propose proposals
240
+ propose_proposals_help: Propose new things.
241
+ read_blogs: Read blogs
242
+ read_blogs_help: Read blogs one by one, from the newest to the oldest.
243
+ read_proposals: Read proposals
244
+ read_proposals_help: Read proposals already made.
245
+ vote_on_proposal: Vote on a proposal
246
+ vote_on_proposal_help: Vote on accepted proposals.
247
+ notification:
248
+ manual: Manual
249
+ manual_help: Advanced notification.
250
+ phase: Phase
251
+ phase_help: Notifies users when a phase changes.
252
+ menu:
253
+ chatbot: Chatbot
254
+ tabs:
255
+ general: General
256
+ menu: Menu
257
+ notification: Notification
258
+ users: Users
259
+ whatsapp: WhatsApp
260
+ tabs:
261
+ onboarding:
262
+ general: You can configure general settings of your chatbot here.
263
+ menu: Customize the menu of actions available for the users. It will be
264
+ grouped by 3 menu items. Re-order menu with drag and drop.
265
+ notification: Customize and test the notification all the whatsapp users
266
+ will receive. Only subscribed users will receive notifications, see
267
+ "Users" tab.
268
+ users: List of users using your whatsapp chatbot. You can unsubscribe
269
+ user to allow them to stop receiving notifications.
270
+ whatsapp: Synced from your WhatsApp Business Profile. Use Sync to refresh
271
+ them.
272
+ not_available: "—"
273
+ users:
274
+ confirm_unsubscribe: Unsubscribe this user from the chatbot?
275
+ empty_html: No WhatsApp users subscribed to this chatbot.
276
+ headers:
277
+ actions: Actions
278
+ email: Email
279
+ name: Name
280
+ phone: Phone
281
+ subscribed: Subscribed
282
+ subscribed:
283
+ "false": Unsubscribed
284
+ "true": Subscribed
285
+ unsubscribe: Unsubscribe
286
+ unsubscribe_error: There was a problem unsubscribing the user.
287
+ unsubscribe_success: User unsubscribed successfully.
288
+ api:
289
+ errors:
290
+ not_found: Chatbot not found
291
+ menu_item_not_found: Menu item not found
292
+ user_not_found: Chatbot user not found
293
+ not_implemented: Chatbot is disabled for this organization
294
+ rest_full:
295
+ models:
296
+ api_client:
297
+ fields:
298
+ scope_whatsapp: 'WhatsApp: read chatbots, menu items, and subscribed users'
299
+ permission:
300
+ whatsapp:
301
+ read: 'read: WhatsApp chatbot resources'
302
+ chatbot:
303
+ settings_updated:
304
+ succeeded: 'Chatbot settings updated: webhook with chatbot snapshot'
305
+ menu_updated:
306
+ succeeded: 'Chatbot menu updated: webhook with chatbot snapshot'
307
+ system:
308
+ api_clients:
309
+ edit_info_tab:
310
+ whatsapp: WhatsApp
311
+ decidim_toggle:
312
+ system:
313
+ decidim_chatbot:
314
+ access_token: WhatsApp access token
315
+ business_id: WhatsApp business ID
316
+ enabled: Enable chatbot
317
+ helptext:
318
+ access_token: Meta Graph API bearer token (stored in plain text for now).
319
+ business_id: Meta WhatsApp Business Account owner business ID.
320
+ enabled: When off, admin Chatbot menu is hidden, RestFull WhatsApp endpoints
321
+ return HTTP 501, and chatbot:create is refused. chatbot:sync still runs
322
+ if token and business ID are set.
323
+ tab: Chatbot
@@ -0,0 +1,29 @@
1
+ ---
2
+ fr:
3
+ decidim:
4
+ chatbot:
5
+ admin:
6
+ items:
7
+ nothing_to_read_label_read_blogs_default: Il n'y a encore rien à lire, revenez plus tard
8
+ nothing_to_read_label_read_proposals_default: Il n'y a pas encore de proposition, revenez plus tard
9
+ default_title_label_propose_proposals_default: "{{id}} Proposition anonyme"
10
+ body_label_propose_proposals_default: Veuillez écrire votre proposition
11
+ verification_label_propose_proposals_default: "Merci, voici votre proposition :"
12
+ action_prompt_label_propose_proposals_default: Que voulez-vous faire de la proposition ?
13
+ save_button_label_propose_proposals_default: Enregistrer
14
+ success_label_propose_proposals_default: Votre proposition a été envoyée
15
+ withdraw_button_label_propose_proposals_default: Retirer
16
+ withdraw_success_label_propose_proposals_default: Votre proposition a été retirée
17
+ creation_not_enabled_label_propose_proposals_default: La création de propositions n'est pas disponible pour le moment, veuillez revenir plus tard.
18
+ title_blank_label_propose_proposals_default: ne peut être vide
19
+ body_blank_label_propose_proposals_default: ne peut être vide
20
+ title_must_start_with_caps_label_propose_proposals_default: doit commencer par une majuscule
21
+ body_must_start_with_caps_label_propose_proposals_default: doit commencer par une majuscule
22
+ title_too_much_caps_label_propose_proposals_default: utilise trop de lettres majuscules (plus de 25% du texte)
23
+ body_too_much_caps_label_propose_proposals_default: utilise trop de lettres majuscules (plus de 25% du texte)
24
+ title_too_short_label_propose_proposals_default: est trop court (le minimum est de %{count} caractères)
25
+ body_too_short_label_propose_proposals_default: est trop court (le minimum est de %{count} caractères)
26
+ title_too_long_label_propose_proposals_default: est trop long (pas plus de %{count} caractères)
27
+ body_too_long_label_propose_proposals_default: est trop long (pas plus de %{count} caractères)
28
+ title_too_many_marks_label_propose_proposals_default: utilise trop de signes de ponctuation consécutifs (par exemple! et?)
29
+ body_too_many_marks_label_propose_proposals_default: utilise trop de signes de ponctuation consécutifs (par exemple! et?)
@@ -0,0 +1,4 @@
1
+ wwwroot/*.js
2
+ node_modules
3
+ typings
4
+ dist
@@ -0,0 +1 @@
1
+ # empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
@@ -0,0 +1,8 @@
1
+ .gitignore
2
+ .npmignore
3
+ api.ts
4
+ base.ts
5
+ common.ts
6
+ configuration.ts
7
+ git_push.sh
8
+ index.ts
@@ -0,0 +1,13 @@
1
+ # OpenAPI Generator Ignore
2
+ # Generated by openapi-generator https://github.com/openapitools/openapi-generator
3
+ #
4
+ # ponytail: generated client only; Activepieces-specific wrappers live in activepieces/, not here
5
+ # Keep the npm export layout across regenerates (same files restfull customized by hand).
6
+
7
+ package.json
8
+ packup.config.ts
9
+ tsconfig.json
10
+ README.md
11
+ .yarnrc.yml
12
+ yarn.lock
13
+ docs/
@@ -0,0 +1,5 @@
1
+ nodeLinker: node-modules
2
+ npmScopes:
3
+ octree:
4
+ npmRegistryServer: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/"
5
+ npmAuthToken: "${NODE_AUTH_TOKEN}"
@@ -0,0 +1,37 @@
1
+ # @octree/decidim-chatbot
2
+
3
+ TypeScript **Axios** client for the Decidim Chatbot RestFull API, generated from `openapi/openapi.json`. Use this package from Node (Activepieces pieces and similar).
4
+
5
+ ## Install
6
+
7
+ GitLab npm (project Package Registry). `.npmrc`:
8
+
9
+ ```
10
+ @octree:registry=https://git.octree.ch/api/v4/projects/507/packages/npm/
11
+ ```
12
+
13
+ ```bash
14
+ npm install @octree/decidim-chatbot
15
+ ```
16
+
17
+ Activepieces (same tarball style as `@octree/decidim-sdk`):
18
+
19
+ ```json
20
+ "@octree/decidim-chatbot": "https://git.octree.ch/api/v4/projects/507/packages/npm/@octree/decidim-chatbot/-/@octree/decidim-chatbot-0.1.0.tgz"
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```ts
26
+ import { Configuration } from "@octree/decidim-chatbot";
27
+
28
+ const config = new Configuration({
29
+ basePath: "https://your-org.example.org/api/rest_full/v0.2"
30
+ });
31
+ ```
32
+
33
+ Generated API classes follow OpenAPI tags (for example chatbot list/show).
34
+
35
+ ## License
36
+
37
+ AGPL-3.0-or-later