New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added instagram channel code #9594
base: main
Are you sure you want to change the base?
Conversation
I added changelog, need help with code quality check, how to run tests and integration tests |
Sweet! I added the other issue it addresses to the description and asked an engineer to give you some guidance. Please make sure to target Rasa Open Source 3.0 since this is an enhancement (check out the repo README for more information) |
Sure will focus on 3.0 but how do I test this with 3.0? |
Any update? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Horizon733 and thanks for your contribution!
I did a review and have a couple of questions for you:
- It looks very very similar to the code in
rasa/core/channels/facebook.py
— I guess it's because Instagram uses Messenger as well. Can we somehow use the same Messenger class that we already have for Instagram conversations or at least write some generic class for both Instagram and Facebook? - Will it work for non-Messenger conversations? The Messenger update for Instagram seems to only be available for those who have their Instagram account linked to their Facebook account (https://about.fb.com/news/2020/09/new-messaging-features-for-instagram/); the rest use standard Instagram messaging.
- Have you considered adding tests for this channel?
|
To be honest, I don't think it's worth adding this class in the current form — the Would be happy to hear more opinions on that. @TyDunn, @wochinge? |
@alwx I did not realize that the APIs were so integrated across Instagram and Facebook. If is just a matter of updating the docs and making slight changes to the existing Messenger channel (e.g. maybe changing the name from |
Yes, we can definitely do that, and add some checks for unique messages of facebook and Instagram. Let me know if anything is there, I could help out in changing facebook.py to messenger.py to keep it generic |
Quick update: I check recently and Instagram is supporting generic template aka carousels. So, if we are planning to make a generic channel for facebook and Instagram. I am up for it |
@Horizon733 that would be much better. If you're interested in working on it then sure, you can go for it (and I can help you with that if you need any help). And sorry for the late response — was a bit busy recently. |
Sure, will start, please let me know anything that I have to keep in mind before starting to code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also add a page to the docs. Probably similar to existing Facebook connector page
Also, I would like to tell you guys, I am not able to run livedocs since it gives me following error. I did check googling it was showing there might be path issue with windows machine.
|
…ram-integration � Conflicts: � tests/conftest.py
…agram-integration
@Horizon733 Are you still interested in getting this reviewed & merged? 🙂 If yes, please take care of the conflicts and then we're happy to take another look! |
Hi I am interested in merging and having this feature, but the reviewing and approval takes so long so this conflicts occur if see all merges above i have solve conflicts many times. I will do solve conflicts if it will be reviewed fast and provide me review. Because as Rasa is this big code are changes everytime in week. |
@Horizon733 Yes, we will be happy to do a fast review! |
ok will fix all conflcts by Friday max. Thanks |
…ram-integration � Conflicts: � .pre-commit-config.yaml � docs/docs/connectors/facebook-and-instagram-messenger.mdx � rasa/nlu/emulators/dialogflow.py � rasa/nlu/extractors/entity_synonyms.py � rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py � rasa/shared/core/generator.py � rasa/shared/core/slots.py � rasa/shared/core/trackers.py � rasa/shared/core/training_data/story_writer/yaml_story_writer.py � rasa/shared/core/training_data/structures.py � tests/core/evaluation/test_marker.py � tests/core/evaluation/test_marker_stats.py � tests/core/featurizers/test_single_state_featurizers.py � tests/core/test_processor.py � tests/graph_components/validators/test_default_recipe_validator.py � tests/nlu/classifiers/test_diet_classifier.py � tests/nlu/featurizers/test_lm_featurizer.py � tests/nlu/selectors/test_selectors.py � tests/nlu/test_train.py � tests/utils/tensorflow/test_models.py � tests/utils/tensorflow/test_rasa_layers.py
@losterloh Can you please review the code and let me know |
Hey @Horizon733, your changes look good but would be great if you can add some tests along with it, as a reference we have the existing channel tests for facebook or any of the other supported channels can be found here. Feel free to take a look and let us know how you feel about this and if you need some more infos. |
Hi @sanchariGr Sorry for late reply, I am writing tests, I will definitely try to push it by this week's end. |
Hi @TyDunn @sanchariGr I am facing below error because of pre-commit and black can you guys please help me out committing and pushing changes so we can move ahead?
The docstrings are similar to which we have in facebook.py channel code not any addon or any removal just typos have been changed then too it is cancelling commits |
Hey @Horizon733 looks to me like both flake8 and black are flagging some linting issues. Can you try fixing the issues you get after running |
Hi @sanchariGr, |
@Horizon733 you might be facing this issue because your local version of black doesnot match the one on the CI, can you please try running |
let me try and push the code |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Horizon733 Unfortunately, the linter will flag any issues in the module that’s being edited, even though that particular code might not have been touched. The only way forward is for you to add docstrings. I have added some to help get started.
@@ -23,15 +23,17 @@ class Messenger: | |||
|
|||
@classmethod | |||
def name(cls) -> Text: | |||
return "facebook" | |||
return "messenger" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "messenger" | |
"""Return channel name.""" | |
return "messenger" |
@@ -170,11 +173,14 @@ class MessengerBot(OutputChannel): | |||
|
|||
@classmethod | |||
def name(cls) -> Text: | |||
return "facebook" | |||
return "messenger" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "messenger" | |
"""Return channel name.""" | |
return "messenger" |
def __init__(self, messenger_client: MessengerClient) -> None: | ||
def __init__( | ||
self, messenger_client: MessengerClient, messenger_service: Text | ||
) -> None: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Initialises input channel.""" |
Also @Horizon733 can you also run all the unit tests locally with |
Proposed changes:
Adding Instagram channel support #9197
Please let me know what all changes are to be done since this is my first PR.
Status (please check what you already did):
black
(please check Readme for instructions)