Camel.toolkits.linkedin toolkit
LinkedInToolkit
A class representing a toolkit for LinkedIn operations.
This class provides methods for creating a post, deleting a post, and retrieving the authenticated user’s profile information.
init
create_post
Creates a post on LinkedIn for the authenticated user.
Parameters:
- text (str): The content of the post to be created.
Returns:
dict: A dictionary containing the post ID and the content of the post. If the post creation fails, the values will be None.
delete_post
Deletes a LinkedIn post with the specified ID for an authorized user.
This function sends a DELETE request to the LinkedIn API to delete a post with the specified ID. Before sending the request, it prompts the user to confirm the deletion.
Parameters:
- post_id (str): The ID of the post to delete.
Returns:
str: A message indicating the result of the deletion. If the deletion was successful, the message includes the ID of the deleted post. If the deletion was not successful, the message includes an error message.
get_profile
Retrieves the authenticated user’s LinkedIn profile info.
This function sends a GET request to the LinkedIn API to retrieve the authenticated user’s profile information. Optionally, it also returns the user’s LinkedIn ID.
Parameters:
- include_id (bool): Whether to include the LinkedIn profile ID in the response.
Returns:
dict: A dictionary containing the user’s LinkedIn profile
information. If include_id
is True, the dictionary will also
include the profile ID.
get_tools
Returns:
List[FunctionTool]: A list of FunctionTool objects representing the functions in the toolkit.
_get_access_token
Returns:
str: The OAuth 2.0 access token or warming message if the
environment variable LINKEDIN_ACCESS_TOKEN
is not set or is
empty.
Reference: You can apply for your personal LinkedIn API access token through the link below: https://www.linkedin.com/developers/apps