Comments (4)
lets do it
from api-reference.
@D-K-P
I tried with BEARER_TOKEN
on OAuth2Bearer
but I unable to overwrite the createTweet
endpoint for use the OAuth 1.0a
auth. https://github.com/twitterdev/twitter-api-typescript-sdk/blob/0d12a20a76d6dd9c346decf9cc80bc611975d43f/src/gen/Client.ts#L897C6-L897C31
Here I tried to change the endpoint
So now I'm using the axios for direct interact with the path. Now I'm getting this error -
{
errors: [
{
message: 'You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product',
code: 453
}
]
}
Is it need for pro account?
Here is the code
import { TriggerClient, eventTrigger } from "@trigger.dev/sdk";
import z from "zod";
import axios from "axios";
const client = new TriggerClient({
id: "api-reference",
});
client.defineJob({
id: "tweet-x",
name: "Tweet X",
version: "1.0.0",
trigger: eventTrigger({
name: "tweet-x",
schema: z.object({
text: z.string(),
}),
}),
run: async (payload, io, ctx) => {
const { text } = payload;
// Wrap an SDK call in io.runTask so it's resumable and displays in logs
await io.runTask(
"Tweet X",
async () => {
try {
await axios.post(
"https://api.twitter.com/1.1/statuses/update.json",
{
status: text,
},
{
headers: {
Authorization: `Bearer ${process.env.X_BEARER_TOKEN}`,
"Content-Type": "application/json",
},
}
);
} catch (e: any) {
console.log(e.response.data);
}
},
// Add metadata to the task to improve the display in the logs
{ name: "Tweet X", icon: "twitter" }
);
},
});
// These lines can be removed if you don't want to use express
import { createExpressServer } from "@trigger.dev/express";
createExpressServer(client);
from api-reference.
@biplobsd The free tier only allows OAuth 2.0 with PKCE
.
Since OAuth 2.0 with PKCE requires user interaction, this poses a challenge in a background job.
The Basic tier ($100/month) allows OAuth 1.0a, and the 1.0 endpoint would probably work for a background job.
from api-reference.
Hey @gjohnsx thanks, I did follow this code https://github.com/twitterdev/Twitter-API-v2-sample-code/blob/0d1587147d3bf8338b5fea2b4e5bb56d37f5c2b6/Manage-Tweets/create_tweet.js#L91
from api-reference.
Related Issues (20)
- Create an example PagerDuty job which uses an HTTP endpoint / trigger HOT 2
- Create an example Hugging Face job which uses an HTTP endpoint / trigger HOT 2
- Create an example Zapier job which uses an HTTP endpoint / trigger HOT 2
- Create an example Novu job which uses an HTTP endpoint / trigger HOT 2
- Create an example Segment job which uses an HTTP endpoint / trigger HOT 3
- Create an example Svix job which uses an HTTP endpoint / trigger HOT 2
- Create an example Mailgun job which uses an HTTP endpoint / trigger HOT 1
- Create an example Microsoft Azure job which uses an HTTP endpoint / trigger HOT 1
- Create an example Todoist job which uses an HTTP endpoint / trigger HOT 3
- Create an example Coinbase job which uses an HTTP endpoint / trigger HOT 1
- Create an example Brex job which uses an HTTP endpoint / trigger HOT 2
- Create an example Rippling job which uses an HTTP endpoint / trigger
- Create an example AWS job which uses an HTTP endpoint / trigger HOT 1
- Create an example X (Twitter) job which uses an HTTP endpoint / trigger HOT 1
- Create an example Asana job which uses an HTTP endpoint / trigger HOT 2
- Create an example YouTube job which uses an HTTP endpoint / trigger HOT 2
- Create an example Gmail job which uses an HTTP endpoint / trigger HOT 1
- Create an example Google Drive which uses an HTTP endpoint / trigger HOT 2
- Create an example Google Sheets which uses an HTTP endpoint / trigger HOT 2
- Create an example Google Docs which uses an HTTP endpoint / trigger HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api-reference.