
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
wa-chat-server-facebook
Advanced tools
wa-chat-server-facebook is a wa-chat-server adapter for the Facebook messenger.
An initialization of the wa-chat-server (in a chat application using wa-chat-server to communicate with Watson Assistant) with a wa-chat-server-facebook adapter looks like this:
require('dotenv').config();
import { WAChatServer, Types } from 'wa-chat-server';
import { WAChatServerFacebookAdapter } from 'wa-chat-server-facebook';
const server: WAChatServer = new WAChatServer((process.env as any) as Types.IWAChatServerConfig);
server.addAdapter('facebook', WAChatServerFacebookAdapter);
server.serve();
We must set the following environment variables (e. g. in .env
):
Variable | Obligatory | Meaning |
---|---|---|
adapter__facebook__facebookApiUrl | Y | https://graph.facebook.com/v13.0/me/messages |
adapter__facebook__facebookToken | Y | Token (1) |
adapter__facebook__chatServerVerifyToken | Y | Verify token (2) |
adapter__facebook__integrationSource | N | Sets value of context variable integration-source . Default value is facebook |
adapter__facebook__replaceHtmlAnchor | N | If set to true the adapter will replace html tags to plain text value |
adapter__facebook__useSenderActions | N | If set to true the adapter will use mark_seen and typing_on sender actions when message is received (might generate additional API calls); If set to any other string (including false ), it will be used as a context variable name and checked in incoming requests (refer to table below for examples); |
Configuration | Context | Will use sender actions? |
---|---|---|
undefined | null | any | N |
true | any | Y |
disableSenderActions | { } | Y |
disableSenderActions | { disableSenderActions: null } | Y |
disableSenderActions | { disableSenderActions: false } | Y |
disableSenderActions | { disableSenderActions: true } | N |
disableSenderActions | { disableSenderActions: 'disabled' } | N |
text
- Text reply (interpreted as Text message)suggestion
- Disambiguation (interpreted as Postback buttons)option
- Options (interpreted as Postback buttons)For local development we need to set up a secure tunnel localhost and Facebook. We can use ngrok for this purpose:
ngrok http 3023
opens a tunel and gives us a public HTTPS URL to be used by Facebook (without an ngrok account the lifetime of the tunnel will be 2 hours). We must then use the Meta for Developers to set the Callback URL:
We may inspect the communication tunneled by ngrok to localhost on http://localhost:4040.
Run
npm run dev
Run
npm link
from the wa-chat-server-facebook root folder.
and then
npm link wa-chat-server-facebook
from the root of your chat application.
FAQs
wa-chat-server adapter for Facebook
The npm package wa-chat-server-facebook receives a total of 1 weekly downloads. As such, wa-chat-server-facebook popularity was classified as not popular.
We found that wa-chat-server-facebook demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.