Refer the common guide for configuring mautrix bridges: Setting up a Generic Mautrix Bridge
The playbook can install and configure mautrix-linkedin for you, for bridging to LinkedIn messaging.
See the project’s documentation to learn what it does and why it might be useful to you.
[!NOTE] LinkedIn keeps its messaging function behind a login wall and does not provide a usable public API, so using this bridge requires you to manually copy cookies on a web browser for logging in. Refer to this section below for details.
If you want to set up Double Puppeting (hint: you most likely do) for this bridge automatically, you need to have enabled Appservice Double Puppet for this playbook.
See this section on the common guide for configuring mautrix bridges for details about setting up Double Puppeting.
To enable the bridge, add the following configuration to your inventory/host_vars/matrix.example.com/vars.yml file:
matrix_bridge_mautrix_linkedin_enabled: true
If you previously ran the older, now-defunct beeper-linkedin bridge on this host, turn it off before you turn this one on. Both bridges claim the same @linkedinbot username and @linkedin_* user range as exclusive appservice namespaces, and two appservices brawling over one namespace means Synapse routes those users at random and one bridge can quietly act as the other’s puppets. The playbook refuses to run with both enabled and says so to your face. Set matrix_bridge_beeper_linkedin_enabled: false and re-run the playbook first: its uninstall path pulls the old registration out of the way, and then this bridge comes up clean.
There are some additional things you may wish to configure about the bridge.
See this section on the common guide for configuring mautrix bridges for details about variables that you can customize and the bridge’s default configuration, including bridge permissions, encryption support, bot’s username, etc.
After configuring the playbook, run it with playbook tags as below:
ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
The shortcut commands with the just program are also available: just install-all or just setup-all
just install-all is useful for maintaining your setup quickly (2x-5x faster than just setup-all) when its components remain unchanged. If you adjust your vars.yml to remove other components, you’d need to run just setup-all, or these components will still remain installed. Note these shortcuts run the ensure-matrix-users-created tag too.
Start a chat with @linkedinbot:example.com (where example.com is your base domain, the bare one without the matrix. prefix) and send login.
First you need to log in to LinkedIn to obtain the request which the web browser sent while signed in. Because the bridge presents itself as Chrome on Linux, you need to obtain it with Chrome or a Chrome-based browser.
[!WARNING] LinkedIn pins the session to the exact browser that made the request, and refuses a session that arrived under a different user-agent. Therefore, if you copy the cURL from Chrome and replay it on Firefox, then the session dies right away.
You need to follow these steps to log in:
graphqlThe bridge’s official Authentication guide walks the same steps with screenshots.
Once you log in, the bridge builds portal rooms for your recent conversations and carries messages both ways.
💡 Notes:
Q. The paste went through, but the bot does not seem to be working. — A. It is most likely because you have obtained the cURL output on other browsers than Chrome or a Chrome-based browser. LinkedIn silently throws out a session replayed under a different user-agent. Please try again with the log in steps described above on Chrome or a Chrome-based browser.
Q. The bot worked yesterday, but does not work today. Why? — A. It is likely because your LinkedIn cookies expired (or LinkedIn had it expired). Please send login to the bot, and follow the login steps described above again.
For everything else, as with all other services, you can find the logs in systemd-journald by logging in to the server with SSH and running journalctl -fu matrix-mautrix-linkedin.
The default logging level for this component is warn. If you want to increase the verbosity, add the following configuration to your vars.yml file and re-run the playbook:
# Valid values: fatal, error, warn, info, debug, trace
matrix_bridge_mautrix_linkedin_logging_level: 'debug'