{"id":13341792,"url":"https://github.com/eva-library/channel-whatsapp","last_synced_at":"2025-03-11T22:31:33.369Z","repository":{"id":128886126,"uuid":"353120477","full_name":"eva-library/channel-whatsapp","owner":"eva-library","description":"Twilio connector that allows you to connect eva with whatsapp","archived":false,"fork":false,"pushed_at":"2021-11-22T13:32:47.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-24T10:07:27.889Z","etag":null,"topics":["channels","eva","twilio","whatsapp"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eva-library.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-30T19:36:55.000Z","updated_at":"2021-11-22T13:32:50.000Z","dependencies_parsed_at":"2023-04-05T16:03:51.018Z","dependency_job_id":null,"html_url":"https://github.com/eva-library/channel-whatsapp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eva-library%2Fchannel-whatsapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eva-library%2Fchannel-whatsapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eva-library%2Fchannel-whatsapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eva-library%2Fchannel-whatsapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eva-library","download_url":"https://codeload.github.com/eva-library/channel-whatsapp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243125202,"owners_count":20240263,"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":["channels","eva","twilio","whatsapp"],"created_at":"2024-07-29T19:26:32.694Z","updated_at":"2025-03-11T22:31:33.364Z","avatar_url":"https://github.com/eva-library.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![N|Solid](https://i.ibb.co/LtT31vK/eva-150px.png)](https://eva.bot/)\n\n## Pre-requisites\n- [Twilio account](https://www.twilio.com/)\n\n## Create account Twlilio\n\n\u003e The first thing we must do is create an account in Twilio.\n\n\u003e Once the account is created, we go to the Functions option and create one.\n\n\n| Create Function |   |\n| ------ | ------ |\n| Function Name | sendMessage |\n| Path | URL_TWILIO/sendMessage |\n\nAnd in the option code insert a similar code.\n```sh\nconst axios = require('axios');\nconst { escape } = require('querystring');\nlet sessions = {};\nexports.handler = function (context, event, callback) {\n    let twiml = new Twilio.twiml.MessagingResponse();\n    let query = decodeURIComponent(escape(event.Body));\n    let number1 = escape(event.From);\n    let mediaContent = ''\n    let link = ''\n    if(event.MediaContentType0 == \"application/pdf\"){\n        query = query+' Link del pdf '\n        link = event.MediaUrl0\n    }else if(event.MediaUrl0){\n        const image = event.MediaUrl0\n        const type = event.MediaContentType0\n        mediaContent = {\n            image,\n            type\n        }\n    }\n    const number = number1.slice(14);\n    let inputText = query.replace(/%20/g, \" \");\n    console.log(number)\n    const body = {\n        \"text\": query,\n        \"phoneNumber\": number,\n        \"userChannel\": 'twilio',\n        \"mediaUrl\": mediaContent,\n        \"mediaLink\": link\n    };\n    let headers = {\n        'Content-Type': 'application/json'\n    };\n    console.log(body);\n    axios.post('URL_TO_SERVICE_POST/api/wsp/receive', body, { headers: headers });\n}\n```\n\u003e We modify the whatsapp connector. Open the **messagesAPI.js** file and find the variables\n- accountSid\n- authToken\n\n[![N|Solid](https://i.ibb.co/GRNHBHG/001.png)](https://i.ibb.co/GRNHBHG/001.png)\n\n\u003e And replace with the credentials that your twilio account gives you.\n\n\u003e With all the connector variables modified, it only remains to deploy the code in any cloud (Azure, GCP, Aws, etc..)\n\nThanks!\n\n**eva professional services**\n\n*Components are not supported\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feva-library%2Fchannel-whatsapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feva-library%2Fchannel-whatsapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feva-library%2Fchannel-whatsapp/lists"}