{"id":24922339,"url":"https://github.com/iconicbot/iconic-narada","last_synced_at":"2025-04-09T18:43:13.177Z","repository":{"id":33278698,"uuid":"154515890","full_name":"iconicbot/iconic-narada","owner":"iconicbot","description":"Open Source Webhook Boilerplate for Social Media/Messaging Platforms(Facebook, Facebook Messenger, Twitter, Twitter Direct, Youtube)","archived":false,"fork":false,"pushed_at":"2022-12-08T15:34:22.000Z","size":347,"stargazers_count":14,"open_issues_count":11,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T14:19:49.816Z","etag":null,"topics":["boilerplate","chatbot","chatbots-framework","developer-tools","facebook","facebook-messenger","twitter","twitter-direct-messaging","webhooks","youtube"],"latest_commit_sha":null,"homepage":"https://iconic.wtf/projects/iconic-narada/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iconicbot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-24T14:29:36.000Z","updated_at":"2024-02-27T02:46:58.000Z","dependencies_parsed_at":"2023-01-15T00:20:05.780Z","dependency_job_id":null,"html_url":"https://github.com/iconicbot/iconic-narada","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iconicbot%2Ficonic-narada","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iconicbot%2Ficonic-narada/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iconicbot%2Ficonic-narada/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iconicbot%2Ficonic-narada/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iconicbot","download_url":"https://codeload.github.com/iconicbot/iconic-narada/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247615417,"owners_count":20967183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boilerplate","chatbot","chatbots-framework","developer-tools","facebook","facebook-messenger","twitter","twitter-direct-messaging","webhooks","youtube"],"created_at":"2025-02-02T11:18:59.891Z","updated_at":"2025-04-09T18:43:13.157Z","avatar_url":"https://github.com/iconicbot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Iconic Narada | Social Media/Messaging Webhooks Boilerplate\n\n[![npm version](https://img.shields.io/badge/npm-v6.4.1-blue.svg?style=flat)](https://opensource.org/licenses/MIT) [![node version](https://img.shields.io/badge/node-v8.12.0-blue.svg?style=flat)](https://opensource.org/licenses/MIT) [![build status](https://travis-ci.org/travis-ci/travis-web.svg?branch=master)](https://travis-ci.org/iconicbot/iconic-narada) [![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT) [![join slack channel](https://img.shields.io/badge/slack-join%20channel-brightgreen.svg?style=flat)](https://join.slack.com/t/iconicnarada/shared_invite/enQtNDY0NTQ5OTY4NjQ2LTI1YTgwNGE4NTE2NTcyMmE0NmJlNWZjNmY2NzI5YjRmMTY2NDFiMDVmZjIxNGRmOTRjMzJiNDM2ZmMyYzFiOTQ)\n\n**Iconic Narada**, developer friendly boilerplate to help you connect Social Media/Messaging platforms via Webhooks.\n\n**Supported Platforms:**\n* Facebook\n* Facebook Messenger\n* Twitter\n* Twitter Direct\n* Youtube\n\n**Why Iconic-Narada?:**\n* Developer friendly\n* Raw social media request/response objects\n* Code from the future (ECMAScript 6 compatible)\n* Database of your choice\n* Server of your choice (Not specific to AWS lambda)\n* Not only for messaging platforms, supports social media too\n* Multiple platforms/channels in 1 boilerplate\n* Better error handling\n* Very low learning curve\n\n\n![overall-structure](https://user-images.githubusercontent.com/473947/47423594-0d71c100-d7a3-11e8-8562-b41da5707f67.png)\n\n## Installation\n\nChoose one of the following options:\n\n* Install with npm: `npm install iconic-narada`\n* To install Iconic Narada from source, first clone the repository and then run: `npm install`.\n\n### Edit config\n\nIn app root directory, rename `.sample-env` to `.env`. You can set app wide environment constants here and access them in your code with `dotenv` module and `process.env`.\n\nIn each example bot directory, you will find `config.json`. You can set bot specific constants here and access them by importing this file into your bot code. You may also instead retrieve this information from database for additional security.\n\n### Enable/Disable a Platform\n\nEach platform has it's own router, controller, parser, elements and connector. The main router in `routes.js` hands over new received event to the router of specific platform.\n\n![data-and-logic-flow](https://user-images.githubusercontent.com/473947/47423631-2bd7bc80-d7a3-11e8-9631-cbaf3aaef58c.png)\n\nTo enable a new platform, import the platform from platforms folder and create a new route for that platform in the main router(routes.js). E.g.: The below code will create a route like - https://your.domain/webhook/facebook\n\n    import facebookRouter from './platforms/facebook/router';\n\n    app.use('/facebook', facebookRouter);\n\n### Run\n\nTo start the app without [babel](https://babeljs.io/), run `node app.js`.\n\nTo start the app with [babel](https://babeljs.io/), run `node start.js`\n\n## Basic Usage\n\nThe business logic of bot is handled in `bots`. Each platform can have it's own configuration which may also be retrieved from database or environment file.\n\nOnce a platform is enabled by adding it to routes, the platform specific Controller in `platforms/\u003cplatform\u003e/controller.js` parses every new event and hands over the parsed event to `bots/\u003cplatform\u003e/index.js`. You can either process the parsed event here or create multiple bots for that platform and redirect the parsed event to respective bot. \n\nBots can use Elements from `platforms/\u003cplatform\u003e/elements.js` to create JSON objects to form a reply or action and, use Connector from `platforms/\u003cplatform\u003e/connector.js` to send the reply or action to platform APIs.\n\nHere are some examples of typical usage:\n\n### Facebook Elements and Connector\n\n#### Importing elements and connector\n\n    import FacebookConnector from '../../../platforms/facebook/connector';\n    import * as FacebookElements from '../../../platforms/facebook/elements';\n\n#### Creating a message\n\nCreate a plain text message.\n\n    const message = new FacebookElements.Text(`Hello there!`);\n\nFor more detailed samples of Facebook Elements, check out [this doc](https://github.com/iconicbot/iconic-narada/docs/Facebook.md).\n\n#### Sending a message\n\nSet the Recipient ID.\n\nEvent object contains basic information like senderId, recipientId, etc based on the type of event received.\n\n    const recipientId = event.senderId;\n\nSet a message.\n\n    const message = new FacebookElements.Text(`Hello there!`);\n\nSet the array of replies to be sent.\n\nReply element method requires a recipient ID and a message. It also accepts a string in place of message object.\n\n    const replies = [\n        new FacebookElements.Reply(recipientId, message),\n        new FacebookElements.Reply(recipientId, 'What\\'s up?'),\n    ];\n\nSend each reply in sequence.\n\n    const facebookConnector = new FacebookConnectorACCESS_TOKEN);\n\n    for (const reply of replies) {\n        await facebookConnector.sendMessage(botConfig.PAGE_ID, reply)\n            .catch(err =\u003e logger.error(err));\n    }\n\n#### Sending an action.\n\nYou can also send an action with/without/before/after a Reply element.\n\n    const replies = [\n        new FacebookElements.MarkSeen(recipientId),\n        new FacebookElements.TypingOn(recipientId),\n        new FacebookElements.TypingOff(recipientId),\n    ];\n\n#### Getting user profile.\n\nYou can get user profile with getUserProfile method.\n\n    const facebookConnector = new FacebookConnector(ACCESS_TOKEN);\n    \n    const userProfile = await facebookConnector.getUserProfile(recipientId)\n        .catch(err =\u003e logger.debug(err));\n\n### Twitter Elements and Connector\n\n#### Importing elements and connector\n\n    import TwitterConnector from '../../../platforms/twitter/connector';\n    import * as TwitterElements from '../../../platforms/twitter/elements';\n\n#### Creating a message\n\nCreate a plain text message.\n\n    const message = new TwitterElements.Text(`Hi there!`);\n\nFor more detailed samples of Twitter Elements, check out [this doc](https://github.com/iconicbot/iconic-narada/docs/Twitter.md).\n\n#### Sending a message.\n\nSet the Recipient ID.\n\nEvent object contains basic information like senderId, recipientId, etc based on the type of event received.\n\n    const recipientId = event.senderId;\n\nSet a message.\n\n    const message = new TwitterElements.Text(`Hello there!`);\n\nCreate an array of replies to be sent.\n\nReply element method requires a recipient ID and a message. It also accepts a string in place of message object.\n\n    const replies = [\n        new TwitterElements.Reply(recipientId, message),\n        new TwitterElements.Reply(recipientId, 'What\\'s up?'),\n    ];\n\nSend each reply in sequence.\n\n    const twitterConnector = new TwitterConnectorOAUTH);\n\n    for (const reply of replies) {\n        await twitterConnector.sendMessage(reply)\n          .catch(err =\u003e logger.error(err));\n    }\n\n\n### Youtube Connector\n\n#### Importing  connector\n\n    import YoutubeConnector from '../../../platforms/youtube/connector';\n\n#### Generating Access token\n    \nFollow the instruction [here](https://help.aolonnetwork.com/hc/en-us/articles/218079623-How-to-Create-Your-YouTube-API-Credentials).\n\n#### Fetch list of comments\n\nYou can fetch the list of comments for a specific video using the commentsList method.\n\n    const youtubeConnector = new YoutubeConnector(ACCESS_TOKEN);\n\n    youtubeConnector.commentsList(videoId).then((data) =\u003e {\n      //Process the data\n    });\n\n#### Add a new comment\n\nYou can add a new comment for a video using the commentInsert method.\n\n    youtubeConnector.commentInsert(videoId, comment).catch(err =\u003e logger.error(err));\n\n### Add a reply to a comment\n\nYou can add a reply to an existing comment using the commentReply method.\n\n    youtubeConnector.commentReply(commentId, comment).catch(err =\u003e logger.error(err));\n\n### Delete a comment\n\nYou can remove a comment using the commentDelete method.\n\n     youtubeConnector.commentDelete(commentId).catch(err =\u003e logger.error(err));\n\n\n\n## Contributing\n\nContributions are generally appreciated. But we are exclusively looking for contributers to help us extend our support to Slack, Telegram, Instagram, WhatsApp, Skype, Youtube, Viber, Amazon Alexa, Line, Kik \u0026 make it a all-in-one open source webhooks boilerplate. \n\nSee the [Contributors' guide](https://github.com/iconicbot/iconic-narada/blob/master/CONTRIBUTING.md) for more information.\n\n## Authors\n\n* [Iconic.wtf](https://iconic.wtf)\n\n## License\n\nThe source code of Iconic Narada boilerplate is licensed under [MIT](https://opensource.org/licenses/MIT). ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficonicbot%2Ficonic-narada","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficonicbot%2Ficonic-narada","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficonicbot%2Ficonic-narada/lists"}