Giter Club home page Giter Club logo

fb-messenger-bot-api's Introduction

Cristian Boarna

Fullstack Developer

banner

About me

I am a seasoned technology professional with a rich background in software development, cloud computing, and data engineering in the "fintech", "medtech", "traveltech" and "energytech" domains. My expertise spans across various domains including TypeScript, Golang, AWS, Docker, and Kubernetes, among others. My experience in leading teams and managing complex projects, combined with my deep technical knowledge, positions me as a valuable asset in any technology-driven organization.

In addition to my technical skills, I am also a proactive problem-solver who thrives in challenging environments. I am a self-starter that has brought to resolution complex problems with only a high level steer needed. I have quickly adapted to new technologies and frameworks, and am committed to continuous learning and improvement. I possess strong communication skills and a collaborative approach that make me an effective team player and leader.

You can find my CV here.

A blog post on how I built my CV can be found here.

Some of my work

Browser Extensions

Focusly

Packages

npm NPM

Plugins

fastlane Fastlane

github Github Action

terraform Terraform

raycast Raycast

raycast Open Source Projects Contributions

Blog Posts

Certifications

Skills

πŸ’…πŸ» Languages

typescript javascript nodejs python golang dart java kotlin kotlin ruby c++

Platforms

aws azure firebase google cloud google cloud

πŸ“š Frameworks

react flutter expressjs flask kafka gatsbyjs spring tailwind

πŸ”¨ Tools

docker kubernetes terraform podman tomcat grafana prometheus fastlane npm intellij vscode github gitlab git jira figma

πŸ“« Social

me in linkedin Blog

me in linkedin Website

me in linkedin LinkedIn

GitHub Streak

fb-messenger-bot-api's People

Contributors

crisboarna avatar greenkeeper[bot] avatar greenkeeperio-bot avatar huydod avatar mohyt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fb-messenger-bot-api's Issues

The IGenericTemplateElement interface default_action missing a required "type" attribute

The IGenericTemplateElement interface default_action missing a required "type" attribute

As per https://developers.facebook.com/docs/messenger-platform/reference/template/generic/

the type "attribute" is required field in the "default_action", I am getting following error:

11-26 17:17:17.063|INFO|{"message":"(#100) The parameter name_placeholder[elements][0][default_action][type] is required","type":"OAuthException","code":100,"fbtrace_id":"C1mIng0Y5Ls"}

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

BUG: the message parser doesnt seem reflect the underlying data.

The parser works great - but it seems to add an extra layer of wrapping around a message - you can clearly see this if you just do a console.log of the parsed message and compare with the class and fields that should be returned.

Currently i need to cast the messages that come out, I will give an example shortly.

Receiving messages from users?

Hi, just wondering if the client here refers to the bot or the user interacting with the bot?

I don't see any instructions on handling messages received from the user.

Thank you!

BUG: Recipient is required

{"message":"(#100) The parameter recipient is required","type":"OAuthException","code":100,"fbtrace_id":"XXX"} is received when trying to use sendTextMessage. The reason is this:

File: https://github.com/crisboarna/fb-messenger-bot-api/blob/master/src/client/FacebookMessagingAPIClient.ts

On line 234, options.json = { recipient: { id } }; sets the recipient. However, on line

220 or 226, options.json is overwritten with the payload (message or sender_action). The payload needs to be added to the json object and not overwrite it. I have tested locally and it works by doing something like options.json.message = payload or options.json.sender_action = payload.

Don't reject bad requests

I send a quick replies as below

await client.sendQuickReplyMessage("id_here", "test", [
  {
    id: "1",
    title: "test",
    payload: "test"
  }
]);

the response from facebook is 400 bad request as below

{
  "error": {
    "message": "(#100) Invalid keys \"id\" were found in param \"message[quick_replies][0]\".",
    "type": "OAuthException",
    "code": 100,
    "fbtrace_id": "GEWn2WN2fuL"
  }
}

but the method resolves the response body instead of rejects it, so I can't catch the error message here

Don't return 'Promise<{}> | undefined' from the api calls

the return signature Promise<{}> | undefined is problematic due to [ts] Object is possibly 'undefined'.. I get the fact that you want to accomodate both callbacks and promises, but one doesnt exclude the other, maybe I'm crazy and want both a callback and a promise returned? I can't see it do any harm to have a promise signature.

API mismatch for Persistent Menu

I should note that I'm loving this library and will be jumping in to contribute and send PRs soon. Thanks for publishing it!

I've noticed that in 'Setting Persistent Menu' section of the readme you have:

const result = await profileClient.setPersistentMenu(senderId, [<MENU_ENTRIES>])

and in the source code:

public setPersistentMenu(menuEntries:Object[], cb?: Function) {
const urlCrumb = 'me/messenger_profile';
const payload: PersistentMenuSettings = {setting_type: 'call_to_actions', thread_state: 'existing_thread',
persistent_menu:[{ locale:'default', call_to_actions: menuEntries }]};
return this.sendConfigurationMessage(payload, urlCrumb, cb);
}

The call is to: 'me/messenger_profile'

However, the senderId isn't passed into the messenger_profile endpoint:
https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api/persistent-menu

But it is passed into the me/custom_user_settings endpoint:
https://developers.facebook.com/docs/messenger-platform/send-messages/persistent-menu#user_level_menu

As a slightly different issue, the composer_input_disabled field is not an option on the API as it only takes the array that is passed into call_to_actions.

Template (and builder) classes are not exported

The docs mentions that this package comes with a bunch of Template and its builder classes (Button, Generic, List, Media, OpenGraph, Receipt, Airline Boarding Pass, Airline Check In, Airline Flight Update, Airline Itinerary) but they are not exported in the src/builders/index.ts file.

Is this intended?

Attachments can be mized array of normal and fallback one

export interface FacebookMessagePayloadMessageEntry { mid: string; is_echo?: boolean; app_id?: number; metadata?: string; seq?: string; text?: string; attachments?: FacebookMessagePayloadAttachments[] | FacebookMessagePayloadAttachmentsFallback[]; quick_reply?: { payload: string; }; }

As the attachment can be normal and fallback one, its type should be
attachments?: (FacebookMessagePayloadAttachments | FacebookMessagePayloadAttachmentsFallback)[];

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The push permission to the Git repository is required.

semantic-release cannot push the version tag to the branch master on remote Git repository.

Please refer to the authentication configuration documentation to configure the Git credentials on your CI environment.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

validateMessageIntegrity method doesn't use the payload body

I've noticed that when creating the hash here:

const authenticationCode = createHmac(xHubSignatureValueParts[0], fbApplicationSecret).digest('hex');

You aren't updating with the payload body. Are you using this successfully in production for an older version of the API? The current API version requires using the payload to verify the request:

To validate the payload:

1. Generate a SHA1 signature using the payload and your app's App Secret.
2. Compare your signature to the signature in the X-Hub-Signature header (everything after sha1=). If the signatures match, the payload is genuine.

https://developers.facebook.com/docs/graph-api/webhooks/getting-started#verification-requests

OAuthException on quickreply

Hi, I'm currently using the api to integrate a custom made fulfillment for Dialogflow, when I try to send quick replies to the user I got the next error message:

2021-08-26T14:46:37.151Z ? workplaceHook: {
2021-08-26T14:46:37.151Z ? workplaceHook:   error: {
2021-08-26T14:46:37.151Z ? workplaceHook:     message: 'An unknown error has occurred.',
2021-08-26T14:46:37.151Z ? workplaceHook:     type: 'OAuthException',
2021-08-26T14:46:37.151Z ? workplaceHook:     code: 1,
2021-08-26T14:46:37.151Z ? workplaceHook:     fbtrace_id: 'Ar79mEkigYjU16TIat8NNva'
2021-08-26T14:46:37.151Z ? workplaceHook:   }
2021-08-26T14:46:37.151Z ? workplaceHook: }

I've even try to convert the response using the Interface IQuickReply, but the outcome is the same

const replies: IQuickReply[] = resp
                    .quickReplies!.quickReplies as unknown as IQuickReply[];
                  const rss = await messagingClient
                    .sendQuickReplyMessage(
                      user.uid,
                      resp.quickReplies!.title!,
                      replies,
                    );
                  console.log(rss);

with only text I have no problems!

`proxyData` parameter is not optional in`Client` constructor

According to your example, Client should be constructed without proxyData

import {Client} from 'fb-messenger-bot-api';
const client = new Client(process.env.PAGE_ACCESS_TOKEN);

However proxyData is not marked as optional so we always have to pass undefined as the second param.
(when using the library in a typescript project)
https://github.com/crisboarna/fb-messenger-bot-api/blob/master/src/client/Client.ts#L39

  public constructor(token: string, proxyData: ProxyData) {
    this.requestData = { token };
    this.requestData = Utils.getProxyData(this.requestData, proxyData);
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.