Skip to content
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

Instagram messaging #1159

Closed
PavelHumeniuk opened this issue Jun 4, 2021 · 8 comments
Closed

Instagram messaging #1159

PavelHumeniuk opened this issue Jun 4, 2021 · 8 comments
Assignees
Milestone

Comments

@PavelHumeniuk
Copy link

Please, add support for Instagram messaging
https://developers.facebook.com/docs/messenger-platform/instagram

@PavelHumeniuk
Copy link
Author

it looks like it is already supported by the existing graph API, but maybe I didn`t find all cases.

@nbartels
Copy link
Contributor

nbartels commented Jun 5, 2021

Hm, I check this. Instagram messaging sounds interesting ...

@nbartels nbartels self-assigned this Jun 5, 2021
@gurkein
Copy link

gurkein commented Jun 6, 2021

NamedFacebookType referenced by Conversation class is not enough to handle "username" and "user_id" fields. Most of the other parts are already supported.

@nbartels
Copy link
Contributor

nbartels commented Jun 6, 2021

@gurkein can you please provide some example json?

@gurkein
Copy link

gurkein commented Jun 7, 2021

From https://developers.facebook.com/docs/messenger-platform/instagram/features/conversation:

Sample Conversation response JSON:

{
  "id": "<THREAD_ID>"
  "participants": {
      'data': [
          {
              "username": "<IG_USER_NAME>" // user name of the user 
              "id":  "<IGSID>" // ig scoped id of the user  
              "user_id": "<IGID>",     
          },
          {
              "username": "<IG_USER_NAME>",// username of the business
              "id":  "<IGID>", // business id      
              "user_id": "<IGID>",
          },
      ]
  }
}

Look at the participants array fields username and user_id. Those are mapped to NamedFacebookType which only includes id and name.

You can implement ExtendedReferenceType which extends NamedFacebookType including those fields. Then you should update NamedFacebookType fields in both Conversation and Message.

Also two new fields have been added to Message class for Instagram. You can find story and reactions fields details from the above link.

Here's an example for those new fields:

{
  ...,
  "reactions" : {
      "data": [
          {
              "reaction": "love",
              "users" : [
                  {
                      "username": "<IG_USERNAME>",
                      "id": "<IGSID|IGID>", //if sent to business then IGID else IGSID
                      "user_id": "<IGID>"
                   }
              ]
          }
      ]
  },
  "story" : {
     "reply_to": { // Story Reply Feature
       "link": "<CDN_URL>",
       "id": "<STORY_ID>"
     },
     "mention": { // Story Mention Feature
        "link": "<CDN_URL>",
        "id": "<STORY_ID>"
     }
  },
  ...
}

@gurkein
Copy link

gurkein commented Jun 7, 2021

For querying user profiles may developers also need a class to map the returned data that has name and profile_pic fields: https://developers.facebook.com/docs/messenger-platform/instagram/features/user-profile

For Facebook profiles UserProfile is used. But it does not have name field.

@gurkein
Copy link

gurkein commented Jun 7, 2021

Additional info: For querying user profiles for Facebook counterpart, a class with a name field is also needed:
https://developers.facebook.com/docs/messenger-platform/identity/user-profile

UserProfile does not have all the fields. Not critical but minor problem. Maybe a generic class for messenger user profiles can be implemented.

@nbartels nbartels added this to the 3.19.0 milestone Jun 8, 2021
@nbartels
Copy link
Contributor

nbartels commented Jun 8, 2021

Many thanks for the input, I try to resolve the current problems, so the next version will provide support for the instagram messaging feature.

nbartels added a commit that referenced this issue Jun 10, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants