How to connect Codex to your LinkedIn messages
Codex is OpenAI's coding agent, but it is happy to do jobs that are not code, and it has one big advantage over a chat app: it can run without you sitting in front of it. With Spaces, Codex can read your LinkedIn messages, sort them and draft or send replies from your own profile. This guide is for the technical founder, consultant or freelancer who already uses Codex. It covers the setup, a worked session, running Codex on a schedule, and the extra care LinkedIn needs when an agent can act on its own.
What you need
- Codex installed and signed in, in the terminal or your IDE.
- A Spaces account. Your trial starts when you connect a chat account, with no card needed.
- The LinkedIn profile your clients and contacts message.
- A short notes file about your work: what you do, availability, and the things you never want said.
- If you want Codex to run on a schedule, a computer or server that stays on.
Step 1: connect your LinkedIn account to Spaces
You sign in to LinkedIn through a secure link and approve the connection. Your account stays yours, and you keep using it on your phone as normal.
Once it is connected, the account shows in your Spaces dashboard. Connecting does not send anything. It only means Spaces can read and send on that account when an AI agent you have added asks it to.
Connect your own LinkedIn profile. LinkedIn restricts automation, and an agent that runs on its own makes that rule matter more, so read the note at the top of this page before you connect.
Step 2: add Spaces to Codex
- Run the command below once. It is saved in ~/.codex/config.toml for every Codex client.
- Run codex mcp login spaces and sign in to Spaces in the browser.
codex mcp add spaces --url https://api.spacesos.com/mcp
codex mcp login spacesTo check it worked: Run codex mcp list, or /mcp inside Codex. Spaces is listed with its tools.
You sign in on Spaces' own page during this step, so Codex never sees your LinkedIn login or your Spaces password. If Spaces does not show up:
- Check the address is exactly https://api.spacesos.com/mcp, with nothing added at the end.
- Run the sign-in step again, in case the first sign-in in the browser did not finish.
- Restart Codex so it reads the new settings.
- If it still does not appear, the Codex MCP docs have the current steps, and our Codex setup page has ours.
Step 3: try it
Start a Codex session in the folder with your notes file, and ask in plain words:
- List my LinkedIn conversations with new messages since yesterday.
- Sort them into clients, enquiries, recruiters and pitches.
- Draft replies to the enquiries using notes/linkedin.md, and do not send them.
- Which conversations have I not answered for three days or more?
Start with a question that only reads, like the first one. It shows you that Codex can see your LinkedIn messages before you let it send anything. Then try a draft, read it carefully, and only then let it send.
Good to know
Unlike ChatGPT or Claude in the browser, Codex can run all the time, or on a schedule, without you starting each session. That means it can keep up with your inbox while you work on something else. It also means it can send when you are not watching, so set it up carefully.
Start with Codex in a normal session, as in the example below, until you trust its drafts. Then move to scheduled runs that read and draft, and only later let them send the simplest replies. A Spaces routine is another option for set replies to set triggers. It is not an AI, and it sends text you wrote in advance.
Codex may ask you to approve tool calls in a session. Leave that on while you are getting started.
A worked session: clearing the inbox from the terminal
Here is an interactive Codex session for a freelance developer who gets work through LinkedIn. Names and details are examples.
| Who | Message |
|---|---|
| You, to Codex | List my LinkedIn conversations with new messages since yesterday, and sort them. |
| Codex | Six conversations. Clients: Ruth asks for an update on the API work. Enquiries: Sanjay asks if you take fixed-price projects, and Claire asks about your availability in February. Recruiters: one. Pitches: two offshore development agencies. |
| You | Draft replies to Ruth, Sanjay and Claire using notes/linkedin.md. Decline the recruiter. Ignore the pitches. |
| Codex | Drafts: Ruth: "Hi Ruth, the endpoints are done and in review. I will send you the staging link by Thursday." Sanjay: "Hi Sanjay, yes, for well-defined work I do fixed-price projects. Could you share a short brief?" Claire: "Hi Claire, I have about two weeks free from mid-February. What did you have in mind?" Recruiter: "Thanks, I am happily freelance, so I will pass." |
| You | Change Ruth's to Friday. Send all four. |
| Codex | Sent four replies from your LinkedIn profile. |
Spaces sends them at least 20 seconds apart. Keeping the notes in a file, as here, means you can change them in your editor and every session picks them up.
Running Codex on a schedule
Because Codex can be run from a script, you can have it check your LinkedIn inbox on a schedule, say every couple of hours in working time, without opening a session. OpenAI's Codex docs explain how to run it that way. A careful set-up looks like this:
- Have each scheduled run read and sort only, and write a short summary for you, such as a file or a message to yourself.
- Let it draft replies, but not send, for at least the first couple of weeks.
- When you trust it, allow it to send only the low-stakes replies: polite declines, thank-yous and simple availability answers.
- Keep fees, contracts and anything delicate for a person, for good.
- Run it in working hours only. LinkedIn conversations rarely need a reply at 3am, and replies at odd hours look odd.
If you use an API key for scheduled runs, keep it in an environment variable rather than in the config file:
[mcp_servers.spaces]
url = "https://api.spacesos.com/mcp"
bearer_token_env_var = "SPACES_API_KEY"Guardrails when an agent acts on its own
- Spaces enforces its LinkedIn limits on every send, however Codex is prompted: at most 100 messages a day and 30 new conversations a day once the account has settled in.
- Connection requests have their own, tighter limits (15 a day and 100 a week on a free account, 25 a day and 150 a week on Premium, Sales Navigator or Recruiter, 4 an hour (5 on a paid account) and at least 90 seconds apart (5 a day in week 1, 10 in week 2, 15 in weeks 3 and 4)). Leave them out of scheduled runs entirely.
- If a run goes wrong, Spaces can pause all sending at once. Reading keeps working, so the next run can still summarise.
- Turn on approvals in Spaces and replies wait there until you approve them, which suits the first weeks of scheduled runs.
- Spaces' terms forbid cold outreach at scale, so keep Codex to people who are already talking to you.
Notes for Codex to read
Keep a notes file in the folder you run Codex from, and tell it to read the file before it drafts anything:
# notes/linkedin.md
About me: freelance backend developer. APIs, data pipelines, integrations.
Rates: day rate and fixed-price quotes are mine to give. Never state a number.
Availability: two weeks free from mid-February. Update this line when it changes.
Tone: friendly, plain, short. First names. No buzzwords.
Ignore: agency pitches, offshore teams, link-building, crypto.
Leave for me: anything about money, contracts, NDAs, or an unhappy client.
Never: send a connection request, message someone who has not written to me, or reply outside 8am-6pm.Codex or a chat app?
| Codex | ChatGPT or Claude in the browser | |
|---|---|---|
| Where it runs | Your terminal, your IDE, or a script | A chat window |
| Can it run without you | Yes, if you set it up to | No, it acts when you ask |
| Notes | A file next to your work | Pasted in, or kept in a project |
| Best for | People who already live in the terminal | Everyone else |
The limits are the same either way, because they belong to your LinkedIn account in Spaces rather than to the agent.
Common mistakes to avoid
- Letting scheduled runs send from day one. Read and draft first.
- Putting the API key in a file that ends up in a repository.
- Running every few minutes. Every couple of hours in working time is plenty for LinkedIn.
- Asking Codex to search LinkedIn and message people. Searches and profile views have limits for a reason, and cold outreach is what LinkedIn restricts.
- Forgetting to update availability in the notes, so Codex keeps offering dates you have filled.
Summing up
With Spaces, Codex can read your LinkedIn inbox, sort it and reply from your profile, either in a session or on a schedule. Keep the notes in a file, start with summaries and drafts, keep invitations out of scheduled runs, and let Spaces' limits and the pause switch be your safety net.
How Spaces keeps your account safe
Whatever you ask, Spaces keeps your LinkedIn account inside safe limits: at least 20 seconds between messages, up to 100 a day, and 30 new conversations a day at most, with a gentler start for a newly connected account. If your AI tries to go faster, Spaces holds the message and says when it can try again.
New conversations warm up over the first weeks after you connect:
| Since connecting | New chats an hour | New chats a day |
|---|---|---|
| Week 1 | 2 | 8 |
| Week 2 | 4 | 15 |
| Weeks 3 and 4 | 6 | 20 |
| After that | 8 | 30 |
A normal message goes to a 1st-degree connection. Anyone else needs a connection request or an InMail.
These are Spaces' own limits. They lower the risk of a restriction, but they cannot remove it, because LinkedIn makes its own decisions about accounts. Read the note at the top of this page before you connect.
Pricing
FAQ
Can Codex answer LinkedIn messages without me?
Yes, if you run it on a schedule. That is the main difference from a chat app. Start with summaries and drafts, and let it send only the replies you are sure about.
Does this use LinkedIn's Messages API?
No. That API is for approved partners. Spaces signs in to your own account, so LinkedIn's User Agreement applies. Read the note at the top of this page.
Can Codex send connection requests?
Spaces can, within tight limits (15 a day and 100 a week on a free account, 25 a day and 150 a week on Premium, Sales Navigator or Recruiter, 4 an hour (5 on a paid account) and at least 90 seconds apart (5 a day in week 1, 10 in week 2, 15 in weeks 3 and 4)). Keep them for people you know, and out of scheduled runs.
Where does the Spaces connection live?
In ~/.codex/config.toml, so every Codex client on your computer can use it once it is added.
What if a scheduled run goes wrong?
Pause all sending in Spaces. Reading keeps working, so you can see what happened, fix the notes and resume.
Can Codex message people who are not my connections?
A normal message goes to a 1st-degree connection. Anyone else needs a connection request or an InMail, so keep to people who expect to hear from you.
Do I need to know how to code?
It helps. Codex lives in the terminal and the IDE. If that is not you, ChatGPT or Claude in the browser does the same LinkedIn job, in sessions you start.