{"bugs":{"url":"https://github.com/atomist/slack-messages/issues"},"dist":{"shasum":"3350ae9920bff21c5e308856ca1f4e8671bb39c3","tarball":"https://registry.npmjs.org/@atomist/slack-messages/-/slack-messages-1.2.2-master.20210108045512.tgz","fileCount":28,"integrity":"sha512-P9B3UMr3YgBqoPKZ1x0C1fQi1cZl9AWw95/8HzrThVEyCY9v4E0a0q6XGNHV2xr0gun6prdVFhpGZASh1YCCzA==","signatures":[{"sig":"MEQCICq4XCnvQqRo0Gtrsghr7v+UMVgp0VnV3sSoAqiE8n9HAiAxsg5lg3AhRxZNZpje6AHrv/pjmc1i3FbgvnBUSRy37w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70207,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf9+YtCRA9TVsSAnZWagAAeAsP/ij9ehKaf33qiX8aPnGx\n2WJp3XWDU9NcG8YGoYwB/9w98CHNUKlBx4nepNMda2VR0RQBJeVd9N0MC26j\nUff+AIrLOU4v/LFf9P7NKuv4NFR0SUCVxjT2ESmJl0TvmZjszh89zFf2zEzT\n0iYnLeqytXVYeIsBtPil81uNEiVUEQt/kTdGdwzmluV8HGT03BaZaca7dKWn\ntidTguHC91NqJc7yD+lo6hLM73iaO/N26Sy8PNGNatyPS0IEm15MIW/WRZXK\n4LLOb/2FrtJZBvPtvApv32bnMlOZtvc3QO+vj/g1slDmZW5/2kwQsJTjM6Go\nr2hpGMOZ0YPt2oikq+yKugqFcYXlpxk6jb0HP21uq5EWVWvyXLGH4+CWNKzD\nStKbG4DXRcU8+DhaxbV1kJPSVrJz4YsPY5rkSq+SNKTU8kle7sq0TIZYiQZ0\nGT2YPDLsjEG5hgcwhulQ3KajU4Cimmfqsi9IkvGv/q/xGbx/ei3JLd4qeBqS\n7xI/WoNEVCeIY/YlPJmbxgN+JT6TRF0nMkwfKG0GXuqO40v9/MJyRlBljFJh\naeP9ldtSyiHd31LmwbZ6zDlq6siGSW4t0LYKKBkpUu3DopqFATSzHGRDTvvQ\nMGIGU6Y+Mi7FtP97Vau3herpXFZwNobU5TJ5POZdgcGpk7DPW4C8jX6rpzTV\nbrHz\r\n=dR6K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./index.js","name":"@atomist/slack-messages","types":"./index.d.ts","author":{"url":"https://atomist.com/","name":"Atomist","email":"support@atomist.com"},"readme":"# @atomist/slack-messages\n\n[![atomist sdm goals](http://badge.atomist.com/T29E48P34/atomist/slack-messages/9e7d7699-14a8-4273-945b-9e5ca08aa38f)](https://app.atomist.com/workspace/T29E48P34)\n[![npm version](https://img.shields.io/npm/v/@atomist/slack-messages.svg)](https://www.npmjs.com/package/@atomist/slack-messages)\n\n[Node.js][node] module that helps to create well-formatted\n[Slack][slackhq] messages sent through the `@atomist` bot from your\nsoftware delivery machine (SDM).  This module also facilitates adding\nactions to your Slack messages that execute SDM commands.\n\nSee the [Atomist documentation][atomist-doc] for more information on\nwhat SDMs are and what they can do for you using the Atomist API for\nsoftware.\n\n[atomist-doc]: https://docs.atomist.com/ (Atomist Documentation)\n[slackhq]: https://slack.com/ (Slack)\n\n## Using\n\nConstruct a message as a plain map following the [Slack message\nformatting API][slack-api].\n\n[slack-api]: https://api.slack.com/docs/message-formatting (Slack message formatting API)\n\n```typescript\nimport { SlackMessage } from \"@atomist/slack-messages\";\n// A very simple message\nconst msg: SlackMessage = { text: \"Simple message\" };\n```\n\n```typescript\nimport {\n    escape,\n    SlackMessage,\n    url,\n} from \"@atomist/slack-messages\";\n// Here is an example of a message with a Slack action (button).\nconst msg: SlackMessage = {\n    text: `${url(user.url, \"@\" + user.name)} opened issue: ${url(issue.url, issue.title)}`,\n    attachments: [\n        {\n            text: escape(issue.body),\n            fallback: escape(issue.title),\n            mrkdwn_in: [\"text\"],\n            actions: [\n                {\n                    text: \"Close issue\",\n                    type: \"button\",\n                    name: \"closeissue\",\n                    value: \"somebuttonid\",\n                },\n            ],\n            callback_id: \"cllbck1\",\n        },\n    ],\n};\n```\n\nAnd then render the message with `render(msg)`.  This will construct a\nJSON string representation of the message:\n\n```typescript\nimport { render } from \"@atomist/slack-messages\"\n\nconst renderedMsg = render(msg);\n```\n\nor to produce a pretty JSON string:\n\n```typescript\nconst renderedMsg = render(msg, true);\n```\n\nThis will produce the following JSON string (pretty version):\n\n```json\n{\n  \"text\": \"<https://github.com/anna|@anna> opened issue: <https://github.com/someorg/somerepo/issues/484|This issue title contains &lt;unsafe&gt; characters and &amp;>\",\n  \"attachments\": [\n    {\n      \"text\": \"This is a very important issue with body containing &lt;unsafe&gt; characters and even &amp;\",\n      \"fallback\": \"This issue title contains &lt;unsafe&gt; characters and &amp;\",\n      \"mrkdwn_in\": [\n        \"text\"\n      ],\n      \"callback_id\": \"cllbck1\",\n      \"actions\": [\n        {\n          \"text\": \"Close issue\",\n          \"type\": \"button\",\n          \"name\": \"rug\",\n          \"value\": \"somebuttonid\"\n        }\n      ]\n    }\n  ]\n}\n```\n\nNote that the `render` function will automatically assign a unique\n`callback_id` to each attachments that has actions.  But, if you\nprovide your custom `callback_id` it will be preserved as is.\n\n### Additional helper functions\n\n#### Special characters\n\n```typescript\nescape(\"Slack requires you to escape <, > and &\");\n// => \"Slack requires you to escape &lt;, &gt; and &amp;\"\n```\n\n#### Links\n\n```typescript\n// Simple link\nurl(\"https://www.atomist.com\");\n// => \"<https://www.atomist.com>\"\n\n// Link with label\nurl(\"https://www.atomist.com\", \"atomist\");\n// => \"<https://www.atomist.com|atomist>\"\n```\n\n#### User & channel links\n\n```typescript\n// @some-user (Slack will display user name for provided user ID)\nuser(\"U123\");\n// => \"<@U123>\"\n\n// #some-channel (Slack will display channel name for provided channel ID)\nchannel(\"C123\");\n// => \"<#C123>\"\n```\n\n#### Special variables\n\n```typescript\n// @channel\natChannel();\n// => \"<!channel>\"\n\n// @here\natHere();\n// => \"<!here>\"\n\n// @everyone\natEveryone();\n// => \"<!everyone>\"\n```\n\n#### Emoji\n\n```typescript\nemoji(\"smile\");\n// => \":smile:\";\n```\n\n#### Markdown\n\nSlack will render markdown if field where markdown is present is\nincluded in `mrkdwn_in` array.\n\n```typescript\nbold(\"This text will appear bold\");\n// => \"*This text will appear bold*\"\n\nitalic(\"This text will appear italic\");\n// => \"_This text will appear italic_\"\n\nstrikethrough(\"This text will appear strike-through\");\n// => \"~This text will appear strike-through~\"\n\n// Single line code block\ncodeLine(\"var a = new A();\");\n// =>  \"`var a = new A();`\"\n\n// Multi line code block\ncodeBlock(\"var a = new A();\\nvar b = new B();\");\n// => \"```var a = new A();\\nvar b = new B();```\"\n\n// List\nlistItem(\"Item 1\");\n// => \"• Item 1\"\n```\n\n### GitHub to Slack markdown conversion\n\nGitHub and Slack markdown are different enough to make your GitHub\nissues or GitHub PRs look quite bad in Slack by default.  You can use\nthe `githubToSlack` function from `Markdown` to convert text that uses\nGitHub markdown to text that will look good in Slack:\n\n```typescript\nimport { githubToSlack } from \"@atomist/slack-messages\"\n\ngithubToSlack(\"* list item 1\\n* list item 2\\n\\**some bold text** and *some italic text* with a link [click here](http://someplace.com)\");\n// => \"• list item 1\\n• list item 2\\n*some bold text* and _some italic text_ with a link <http://someplace.com|click here>\"\n```\n\n## Support\n\nGeneral support questions should be discussed in the `#help`\nchannel in the [Atomist community Slack workspace][slack].\n\nIf you find a problem, please create an [issue][].\n\n[issue]: https://github.com/atomist/slack-messages/issues\n\n## Development\n\nYou will need to install [Node.js][node] to build and test this\nproject.\n\n[node]: https://nodejs.org/ (Node.js)\n\n### Build and test\n\nInstall dependencies.\n\n```\n$ npm install\n```\n\nUse the `build` package script to compile, test, lint, and build the\ndocumentation.\n\n```\n$ npm run build\n```\n\n### Release\n\nReleases are handled via the [Atomist SDM][atomist-sdm].  Just press\nthe 'Approve' button in the Atomist dashboard or Slack.\n\n[atomist-sdm]: https://github.com/atomist/atomist-sdm (Atomist Software Delivery Machine)\n\n---\n\nCreated by [Atomist][atomist].\nNeed Help?  [Join our Slack workspace][slack].\n\n[atomist]: https://atomist.com/ (Atomist - How Teams Deliver Software)\n[slack]: https://join.atomist.com/ (Atomist Community Slack)\n","engines":{"npm":">=5.0.0","node":">=8.2.0"},"gitHead":"597ea6679b4f903b604949f73f8906df3e53dda6","license":"Apache-2.0","scripts":{"doc":"typedoc --mode modules --excludeExternals --ignoreCompilerErrors --exclude \"**/*.d.ts\" --out doc index.ts lib","lint":"eslint --ext .ts .","test":"mocha --require espower-typescript/guess \"test/**/*.test.ts\"","build":"run-s clean compile test lint doc","clean":"run-p clean:compile clean:doc clean:run clean:test","compile":"tsc --project .","autotest":"supervisor --watch index.ts,lib,test --extensions ts --no-restart-on exit --quiet --exec npm -- test","lint:fix":"npm run lint -- --fix","test:one":"mocha --require espower-typescript/guess \"test/**/${TEST:-*.test.ts}\"","clean:doc":"rimraf doc","clean:npm":"rimraf node_modules","clean:run":"rimraf *-v8.log profile.txt log","clean:dist":"run-s clean clean:npm","clean:test":"rimraf .nyc_output coverage","clean:compile":"rimraf git-info.json \"index.{d.ts,js}{,.map}\" \"{lib,test}/**/*.{d.ts,js}{,.map}\" lib/typings/types.ts"},"_npmUser":{"name":"atomist-bot","email":"npm@atomist.com"},"homepage":"https://github.com/atomist/slack-messages#readme","keywords":["atomist","automation","sdm","slack"],"repository":{"url":"git+https://github.com/atomist/slack-messages.git","type":"git"},"_npmVersion":"6.13.6","description":"Atomist utilities for creating formatted Slack messages","directories":{"test":"test"},"maintainers":[{"name":"atomist-bot","email":"npm@atomist.com"},{"name":"ddatomist","email":"david@atomist.com"},{"name":"cdupuis","email":"cd@atomist.com"},{"name":"slimslenderslacks","email":"slimslenderslacks@gmail.com"}],"_nodeVersion":"13.7.0","dependencies":{},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"mocha":"^8.1.3","eslint":"^7.10.0","rimraf":"^3.0.2","ts-node":"^9.0.0","typedoc":"^0.19.2","prettier":"^2.1.2","supervisor":"^0.12.0","typescript":"^4.0.3","npm-run-all":"^4.1.5","@types/mocha":"^8.0.3","power-assert":"^1.6.1","espower-typescript":"^9.0.2","@types/power-assert":"^1.5.3","eslint-config-prettier":"^6.12.0","eslint-plugin-prettier":"^3.1.4","@typescript-eslint/parser":"^4.4.0","@typescript-eslint/eslint-plugin":"^4.4.0"},"_npmOperationalInternal":{"tmp":"tmp/slack-messages_1.2.2-master.20210108045512_1610081837288_0.32943234159739876","host":"s3://npm-registry-packages"},"_id":"@atomist/slack-messages@1.2.2-master.20210108045512","version":"1.2.2-master.20210108045512"}