4

When adding a connection using the Twitter connector offered by the Unification Engine, what are the parameters that need to be used and how are they to be passed in the URI?

ctn
  • 2,887
  • 13
  • 23

2 Answers2

3

Let me explain the commands used to add a twitter connection in #UnificationEngine

To add twitter connection in #UnificationEngine use

curl -XPOST https://apiv2.unificationengine.com/v2/connection/add \
     -u USER_ACCESSKEY:USER_ACCESSSECRET \ 
     --data '{"uri":"twitter://ACCESS_TOKEN:SECRET@twitter.com","name":"UNIQUE_CONNECTION_IDENTIFIER"}' \
     -k

ACCESS_TOKEN:SECRET - is the one got by authentication the twitter connection in the user application.

UNIQUE_CONNECTION_IDENTIFIER - specified here will be further used to address this connection in UE. f.e to send a tweet the user will have to use the variable specified under UNIQUE_CONNECTION_IDENTIFIER

Martin
  • 665
  • 1
  • 7
  • 24
AMT.in
  • 391
  • 1
  • 5
3

To send tweet use

curl -XPOST https://apiv2.unificationengine.com/v2/message/send \
--data "{ \"message\": { \"receivers\": [{\"name\": \"name\", \"address\": \"TWITTER_HANDLE\" , \"Connector\": \"UNIQUE_CONNECTION_IDENTIFIER\"}],\"parts\": [{\"id\": \"1\",\"contentType\": \"text/plain\", \"data\":\"MESSAGE_CONTENT\" ,\"size\": MESSAGE_CONTENT_SIZE,\"type\": \"body\",\"sort\":0}]}}" \
-u USER_ACCESSKEY:USER_ACCESSSECRET -k

Where USER_ACCESSKEY:USER_ACCESSSECRET is got when you add the user using UE_APPKEY:UE_APPSECRET

curl -XPOST https://apiv2.unificationengine.com/v2/user/create -u UE_APPKEY:UE_APPSECRET \
--data '{}' -k

Response data:

{"status":200,"info":"200 OK","uri":"user://USER_ACCESSKEY:USER_ACCESSSECRET"}
Martin
  • 665
  • 1
  • 7
  • 24
AMT.in
  • 391
  • 1
  • 5
  • I am getting error while posting messages on twitter, error says -> status:411 and info:'connection does not exist'. Whereas while I added conenction and testing connection and got 200 status code for both. Can you help me in this? – Always_a_learner Jan 06 '17 at 10:59
  • On twitter connector within my UE APP it is showing 0 users, while in facebook connector it is showing 104 users. – Always_a_learner Jan 06 '17 at 11:11