Integrating Twitter Direct Message into Qiscus Multichannel

By default, Qiscus Multichannel provides several channels that you can activate as your source of incoming messages. However, you might also require other channels to be used in your business flow. Let’s take Twitter Direct Message (Twitter DW) as an example. In order for you to enable this channel, you could make use of the Custom Channel feature in Qiscus Multichannel. In the Qiscus documentation, it states that:

The idea behind this custom channel is that you provide your own server to be hooked by messaging services (Telegram, Slack, WeChat, Email, SMS, etc) to send a message. The message will then be passed to Qiscus Multichannel CS Chat by your server to be gathered in the Qiscus Multichannel CS Chat dashboard.

In this article, we will cover on the topic of integrating Twitter DM into the Qiscus Multichannel CS Chat. It is important to note though that as this is an unofficial support from Qiscus Multichannel, you will still need to maintain your service by yourself. Let’s hope Qiscus Multichannel will include Twitter DM as a built-in channel in the future! Let’s get to the code.

Twitter

First things first, in order to use Twitter DM as your new channel in Qiscus Multichannel, you need to have a Twitter Developer account since we will be using its Access Token in the process. You can register here: http://developer.twitter.com.

After you have registered as a developer in Twitter, you can create a new app. Fill in the forms as they suit your project. In this example, I named it “Twitter DM Channel.”

After that, go to the “Keys and Tokens” tab and generate access token. We will use it later in the intermediary service to connect between Twitter and Qiscus Multichannel.

Next, you need to also change the permission access to include access to Direct Message API. Go to the Permissions tab and check the last option.

Last but not least, we need to set up a dev environment. Go to the Dev environments page and setup the Account Activity API dev environment.

Specify the label you want to use and choose the app we have just created.

That’s all for the Twitter part. Next, we need to set up a new custom channel in the Qiscus multichannel.

Multichannel

If you haven’t signed in yet, please do so now at https://multichannel.qiscus.com and then go to the Integration page:

Create a new custom channel by clicking “Add Channel” button.

Please specify your channel name and identifier key. You can fill in the Channel name as “Twitter DM”. This name will appear on the channel tab later. As for the Identifier key, you could use anything you want. This key is used to match the source of request coming from your webhook. This is the required param. Finally Webhook URL, this should be your custom channel webhook URL, which is the intermediary service you are going to build.

Intermediary Service Infrastructure

We have already set up Twitter App and Custom channel in the previous steps. So what’s next is to have our intermediary service ready. This service acts as a bridging service that will fulfill the following rule:

  1. Receive webhook from Twitter DM.
  2. When your service receives the message, it needs to post the message to Qiscus Multichannel CS Chat with the following format.

Header:

URL:

Params:

You can check the details at https://documentation.qiscus.com/multichannel-customer-service/customization#custom-channel

In this example, we use AWS Lambda, API Gateway and Python 3.7. You could access the repo at https://bitbucket.org/qiscus/twitter-custom-channel

To deploy the code to AWS lambda:

  • The code using chalice as python micro-framework serverless.

  • Request API to register webhook. Twitter sends message or event to your service in this URL. Please note, the endpoint must be “/webhooks/twitter”

That’s all.

Comments

Leave a Comment

skin care tips Aphrodisiacs skin fresh cream ed treatment natural male enhancement pill male enhancement pill Strengthen Penis gaia male libido best face cream paravex male enhancement banner Sexual Stimulation sexual and reproductive health courses Velocity Max premium male enhancement Fast Work Male Pills traction penile extenders Fast Hard Sex viagra for men and women Penis Enlargement what are sex pills Male Sexual Health apx male enhancement Medications And Libido where can i buy male enhancement pills locally Erectile Dysfunction male health supplements Erectile Dysfunction femstimmax Male Enhancement Pills sex pills online Strengthen Penis over the counter male stimulants Erectile Dysfunction viagra for men and women Free Trial Pills best male size enhancement pills Sexual Activity hard sex men Male Enhancement Pills male sex enhancement drugs Medications And Libido femstimmax Sexual Pill gold max female Improve Erectile Function sex pills online ED Tablets kangaroo female pill Male Sexual Health rhino for men Erection Problems best male enhancer pill Erectile Dysfunction 711 sex pills Free Trial Pills sex mood enhancer Last Long Enough Erection