function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hitesh chaudhariHitesh chaudhari 

how to post data in twitter through api call

I am trying to post a messge on twitter using API but unable to update Following is the error message I am getting 
Your credentials do not allow access to this resource. 

I am trying to call POST method on 'https://api.twitter.com/1.1/direct_messages/events/new.json'
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

Please refer to the below links which might help you further with the above requirement.

http://www.bitspace.in/2015/12/twitter-api-integration-with-salesforce.html

https://forceadventure.wordpress.com/2014/03/03/interacting-with-the-twitter-api-from-salesforce/

http://www.saaspie.com/salesforce-twitter-integration-using-oauth/

http://www.bridgefarmconsulting.com/blog/twitter-authentication/

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Deepali KulshresthaDeepali Kulshrestha
Hi ImNick,

First you need to create a new application in Twitter.
After you create the app you will be provided with the following information:
--Consumer Key (API Key)
--Consumer Secret (API Secret)
For making a callout with Twitter, we have to use the above values. We have to authenticate the user and get the necessary token.
Step 1: Retrieve request token and token secret by sending a POST HTTP request to this endpoint:
https://api.twitter.com/oauth/request_token
The authorization header should contain parameters like: nonce, callback url, signature, timestamp, signature method. You can find the format here: https://dev.twitter.com/oauth/reference/post/oauth/request_token
https://gist.github.com/5667c281bb14ea83ddf2.gitCreate a base string using the following function so that you can generate the Twitter signature:
https://gist.github.com/8f8dd6c1674668fc2f04.git
To retrieve the token since Twitter is returning the token in urlencoded form.
https://gist.github.com/0fb0f45699797fc77560.git
Now that you have the request token, you need to authenticate the user using the request token. When the user authenticates the application, you will be redirected to the page specified in the call back url. You can find more details here: https://dev.twitter.com/oauth/reference/get/oauth/authenticate
Retrieve the verifier and the verifier token from the url.
https://gist.github.com/fb3a2cb7fd73cd2f695a.git
Now that you have the verifier code, you can finally get the access token by passing a POST HTTP request to this end point just like we did to obtain a request token:
https://api.twitter.com/oauth/access_token
The response will contain the screen name from which you can get the user details of the Twitter user.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha