How do I get twitter to work - need detailed instructions please!!

webguru's Avatar

webguru

03 Jan, 2010 08:28 PM via web

I need to know how to authenticate with Twitter (including possibly the instructions on the twitter side).

I assume the following:

  1. People log into my website
  2. Add Twitter as one of thier social networks
  3. My system emails them with a secret code
  4. They follow my twitter acct (bot); then tweet me with that secret code
  5. The bot.php replies with a message saying it was recieved AND adds the userkey to my database for thier twitter acct (step 2)
  6. Now I can tweet them....

Is this how it works? How do I get my bot to send tweets to my users twitter accounts?

dbmdude

  1. Support Staff 2 Posted by Adam Kalsey on 05 Jan, 2010 02:29 AM

    Adam Kalsey's Avatar

    I'm not sure I understand what you're asking. Twitter works just like
    IM or SMS. Someone sends you a message and you reply. If the message
    is sent by an @reply, the reply also is sent via @. If they send your
    bot a message via DM, the reply is as a DM.

    You can only send direct messages to users that follow you, so your
    users should follow your bot to ensure they can get your replies.

    If you want to match a twitter user up to a user of your web
    application, you can do that as simply as asking them for their
    twitter ID while they're already logged in to your web app. Some
    developers choose to require that the user verifies their twitter ID,
    similar to how you'd verify a user's email address: send them a link
    and ask them to click on it. If the person who clicks the link is
    logged into the correct account on your site, you've verified them.

  2. 3 Posted by webguru on 05 Jan, 2010 05:24 AM

    webguru's Avatar

    OK I just ran a test.

    I have a twitter account for myself (call it dbmdude1) and a twitter account for my bot (call it dbmdude2). So while I was on as dbmdude1 I set up my twitter account to follow dbmdude2 (the bot) and I still cannot DM the bot from there. The only way I was able to DM the bot was if the bot was following ME.

    Am I missing something in what you said? You said: "so your users should follow your bot to ensure they can get your replies"; yet I had to log into the BOT acct in order to allow the non-bot account the ability to DM it.

    Again I am not a twitter user so I am clueless here. I still need to be hand held on this topic. I need step by step to do this.

    NOW another thing said up there was "you can do that as simply as asking them for their twitter ID while they're already logged in to your web app"; and this boggles my mind... in order to send a message to the twitter account do I not need the userkey of the account that is signing up? Where do I get it?

    As the main account (dbmdude1) even if I follow the bot account (dbmdude2) I cannot DM that bot. The bot HAS to follow my account and this is where I am getting confused.

    dbmdude

    PS:

    I just sent 2 DMs from dbmdude1 to dbmdude2 which should be my bot and the bot never responded. I see the two messages in the dbmdude2 account (bot account) but never got a response at all from the bot.

    PPS

    OK the bot responded; however the one remaining issue is how do I as a "user" send a message to the twitter bot if the bot is not following them?

  3. 4 Posted by webguru on 05 Jan, 2010 05:50 AM

    webguru's Avatar

    The way I see it this is what has to happen...

    1. they log into my web ap and add there twitter account...
    2. I send them an email with a code
    3. they DM the code to my bot; this way I get the userkey
    4. now I can send them DMs

    NOW in step 3 - how the heck can they DM my bot twitter account unless my twitter account is following them?

    "You can only send direct messages to users that follow you, so your users should follow your bot to ensure they can get your replies"

    That very statement tells me my bot has to "follow my users" and I have no clue if they are just signing up on my websp how to do that.

  4. Support Staff 5 Posted by Adam Kalsey on 05 Jan, 2010 06:54 AM

    Adam Kalsey's Avatar

    Yes, twitter, requires that you be following a user in order for them
    to DM you. It's a privacy protection of sorts. For someone to send
    your bot you'd need your bot's Twitter account to be following the
    user.

    Because Twitter doesn't programmatically let anyone know when your bot
    get followed, we have no way of autofollowing them. Twitter does send
    an email when you get followed, so if you wanted to automate it, you
    could parse the incoming email and use Twitter's API to follow a user.

    We see Twitter as a bit different than IM. We expect that most people
    using Twitter bots will be augmenting their human-created twitter
    content with bot responses.

  5. 6 Posted by mlucas on 15 Oct, 2010 04:29 PM

    mlucas's Avatar

    It looks like we've answered this for you, so we're going to mark this question as resolved. If you have any questions, you can re-open this issue or send a new one in and we'll be glad to help.

    -Matt Lucas
    IMified Support

  6. mlucas closed this discussion on 15 Oct, 2010 04:29 PM.

Comments are currently closed for this discussion. You can start a new one.