Send/Receive Direct Messages


#1

Can anyone tell me how can I implement Sending and Receiving direct messages using fabric?


#2

Hey @adi290491,

Fabric currently doesn’t allow for sending or receiving DMs through Twitter Kit.

-Mike


#3

Hi!

Mike’s correct that Twitter DM functionality isn’t part of the Fabric feature set today, although you can use Twitter Kit to work with the API, it just requires a bit of manual set-up:

  1. To use the Twitter direct messages API you’ll need to set up a separate set of app keys from https://apps.twitter.com, and select the Read, Write and DMs permission. You’ll then need to update your app configuration file to use the new key and secret instead of the one we generated for you through Fabric.
  2. Second, when logging in with Twitter you’ll need to explicitly invoke the web browser flow for auth: iOS built-in accounts don’t allow users to grant access to their messages. You can do this by forcing TWTRLoginMethodWebBased for the loginMethods.
  3. With that done, a user can give your app permission to load their DMs, and you can use Twitter Kit to talk to the API as normal.

Hope that helps!

Ben


#4

Hi,
Thanks a lot. I finally got the solution working when I used the Twitter
API key and secret. I was confused between the fabric provided ones and the
Twitter provided ones. Unknowingly i was using the fabric provided API key.
That’s why it was not working. I would also like to ask if there is any
Java bean class to receive the DM API response.