Twitter DM

Like most social media platforms, Twitter gives you an option to send private messages to users. Twitter Direct Messages enable businesses to take an interaction with a user from the public timeline to a private conversation.

Our Twitter DM integration allows you to send & receive direct messages on Twitter using your own account. You will receive these messages in a business system or with webhooks.

Capabilities

Twitter supports a wide variety of capabilities as seen in the channel capabilities grid. Below is a detailed view of each capabilities.

Content Types

  • Text

    Full SupportAPI
  • Image

    Full SupportAPI
  • File

    Partial SupportAPI
  • Emoji

    Full SupportAPI
  • GIF

    Full SupportAPI

Action Types

  • Link

    Full SupportAPI
  • Extensions

    Partial SupportAPI
  • Buy

    Full SupportAPI
  • Postback

    Full SupportAPI
  • Replies

    Full SupportAPI
  • Location Request

    Full SupportAPI

Structured Messages

  • Compound Messages

    Full SupportAPI
  • Carousel

    Partial SupportAPI

Indicators

  • Typing

    Full SupportAPI
  • Read

    Full SupportAPI

Delivery Events

Delivery events allow you to track deliveries of Smooch messages to Twitter DM by subscribing to the message:delivery:channel webhook. Failures to deliver a message to Twitter DM can be detected by subscribing to the message:delivery:failure webhook.

Setup

There are two ways to set up a Twitter integration: using the Smooch dashboard, or using the integration API.

Using the Dashboard

Twitter can be integrated directly using the Smooch dashboard. With this option you’re granting Smooch access to act on behalf of your Twitter account. Note that access to this option is limited to a per request basis. Contact us to request access.

If however you have your own Twitter Account Activity API subscription or you’re willing to set one up, you can set up a Twitter integration using the integration API. The section below guides you through this process.

Using the Integration API

In this option you’ll be using your own Twitter app to act on behalf of a business Twitter account. If you’re building your own user experience for businesses to integrate their Twitter accounts with your software, this option is for you.

Twitter App Setup

The steps below describe how to set up a Twitter app that can be used to create Smooch Twitter integrations.

  1. First, you’ll need to set up an Account Activity API Subscription with Twitter. Twitter offers several tiers of access: a free sandbox option for testing purposes, as well as paid premium and enterprise tier subscriptions.

  2. Create a Twitter app if you don’t already have one. Twitter apps can be managed via the Twitter app dashboard. Take note of your Twitter app consumer key and secret.

  3. With the sandbox and premium tiers you will need to create a dev environment associated with your Twitter app. You can do this via the dev environments dashboard. Take note of your dev environment label. You will need to specify this in the envName parameter when configuring the integration with Smooch.

You now have a Twitter app that’s ready to power new Smooch Twitter integrations!

Smooch Twitter Integration Setup

We’re now going to use the Twitter app we configured in the steps above to connect Smooch with a specific Twitter account representing your business.

  1. First, acquire an Access Token Key and Secret on behalf of the business’ Twitter account. These can be obtained via the Twitter OAuth Flow. Note that if you’re just testing things out, you can integrate with your Twitter app’s owner account by using the access token and secret found under your app’s Keys and tokens tab.

  2. Call the Smooch Create Integration endpoint. You’ll need to include:

    • tier: Your Twitter subscription tier (sandbox, premium or enterprise).
    • envName: Your dev environment label (sandbox and premium tiers only)
    • consumerKey and consumerSecret of your Twitter app
    • accessTokenKey and accessTokenSecret that were issued on behalf of the Twitter account you’re integrating with, obtained in the previous step

Please see the Smooch API docs for more details on how to call this API.

Direct Messages

In order for a business to receive direct messages from anyone (including accounts it does not follow), the option must be enabled in Twitter’s settings. Go to Twitter’s privacy and safety settings and check “Receive Direct Messages from anyone”. Be sure to save your changes!

Twitter DM

Invitation to Direct Message Conversations

You can easily send links to your users to direct them to a private conversation from a public Tweet.

Sending https://twitter.com/messages/compose?recipient_id={your account’s numeric user ID} will render in twitter a “Send a private message” button like this:

send private message

You can find your User ID here:

twitter userid

These links also works anywhere on the web. Read more details about the “Send a private message” link here.