{"id":18548,"library":"messaging-api-common","title":"Messaging API Common Helpers","description":"messaging-api-common provides shared utilities (case conversion and Axios request interceptors) for the messaging-apis family of chatbot SDKs (Messenger, LINE, Slack, Viber, Telegram). Currently at v1.0.4 (Jan 2021) with no further releases; the project has moved to v1.1.x of other packages but this common package remains unchanged. Keys differ from alternatives by offering both shallow and deep snakecase/camelcase/pascalcase conversions plus a factory for Axios interceptors. TypeScript types are included.","status":"maintenance","version":"1.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/Yoctol/messaging-apis","tags":["javascript","bot","chatbot","messaging-apis","typescript"],"install":[{"cmd":"npm install messaging-api-common","lang":"bash","label":"npm"},{"cmd":"yarn add messaging-api-common","lang":"bash","label":"yarn"},{"cmd":"pnpm add messaging-api-common","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package supports both ESM and CJS. Use ESM for tree-shaking.","wrong":"const { snakecaseKeysDeep } = require('messaging-api-common')","symbol":"snakecaseKeysDeep","correct":"import { snakecaseKeysDeep } from 'messaging-api-common'"},{"note":"Named export, not default.","wrong":"const camelcaseKeys = require('messaging-api-common').camelcaseKeys","symbol":"camelcaseKeys","correct":"import { camelcaseKeys } from 'messaging-api-common'"},{"note":"It's a named export, not default.","wrong":"import createRequestInterceptor from 'messaging-api-common'","symbol":"createRequestInterceptor","correct":"import { createRequestInterceptor } from 'messaging-api-common'"}],"quickstart":{"code":"import { snakecaseKeysDeep, camelcaseKeys, createRequestInterceptor } from 'messaging-api-common';\nimport axios from 'axios';\n\n// Case conversion\nconst original = { fooBar: { barFoo: 1, bazQux: [ { nestedKey: true } ] } };\nconst snake = snakecaseKeysDeep(original);\nconsole.log(snake);\n// { foo_bar: { bar_foo: 1, baz_qux: [ { nested_key: true } ] } }\n\nconst camel = camelcaseKeys(snake.foo_bar, { deep: false });\nconsole.log(camel);\n// { barFoo: 1 }\n\n// Axios interceptor\nconst instance = axios.create({ baseURL: 'https://api.example.com' });\ninstance.interceptors.request.use(createRequestInterceptor());\ninstance.get('/data').then(console.log);","lang":"typescript","description":"Demonstrates deep snakecase conversion, shallow camelcase conversion, and adding an Axios request interceptor."},"warnings":[{"fix":"Use the *Deep variants for recursive conversion.","message":"snakecaseKeys and camelcaseKeys do NOT deep-convert by default. Use snakecaseKeysDeep and camelcaseKeysDeep for deep conversion.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Migrate to newer messaging-apis packages that include these utilities internally.","message":"The package is no longer actively maintained; major version 1.0.0 introduced breaking changes (camelcase keys).","severity":"deprecated","affected_versions":"1.0.0"},{"fix":"Manually handle arrays or use a custom conversion function.","message":"pascalcaseKeys does NOT handle arrays properly; it converts array elements to PascalCase strings which may not be intended.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use import syntax or set type: 'module' in package.json and use import.","cause":"Using CJS require on a package that resolves to ESM in some bundler configurations.","error":"TypeError: Cannot destructure property 'snakecaseKeysDeep' of 'require(...)' as it is undefined."},{"fix":"Run 'npm install messaging-api-common' and ensure the package is in 'dependencies'.","cause":"Package not installed or bundler misconfigured.","error":"Error: Cannot find module 'messaging-api-common'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}