Package: pyexotel
PyExotelWelcome to PyExotel, an unofficial Python package for interacting with Exotel's API. With PyExotel, you can easily make phone calls, manage campaigns, and gather information about calls and phone numbers using your Exotel API credentials.InstallationTo install pyexotel, usepip:pipinstallpyexotelExotel Class - Call MethodsTo use PyExotel, you will first need to create an instance of the Exotel class with your Exotel API key, API secret, SID, and domain. You can find these credentials in the Exotel Dashboard.frompyexotelimportExoteldialer=Exotel(api_key="exotel_api_key",api_secret="exotel_api_secret",sid='exotel_sid',domain="exotel_domain")Parametersapi_key (str): Your ExotelAPI key.api_secret (str): Your ExotelAPI secret.sid (str): Your ExotelSID.domain (str): Exotel APi Domain ( Singapore cluster isapi.exotel.com(default) & Mumbai cluster is api.in.exotel.com)ccm_domain(str): Exotel CCM Api Domain ( Singapore cluster isccm-api.exotel.com& Mumbai cluster isccm-api.in.exotel.com(Default))ForExotelinstance, you can now use the various methods available to interact with the Exotel API. Some things you can do include:Place a CallTo place a call from one phone number (agent_number) to another (customer_number), use the call method:response=dialer.call(agent_number="NumberA",customer_number="numberB",caller_id="exotel_callerID")Connect a Call to a FlowTo connect a call from a customer (customer_number) to a specific flow (or applet) using Exotel's API, use theconnect_flowmethod:response=dialer.connect_flow(customer_number,called_id,flow_id)Get Call InformationTo get information about a call, such as its timing and recording URL, use theget_call_infomethod:exotel.get_call_info(call_sid="call_sid")Get Phone InformationTo get information about a phone number, such as its operator name and DND status, use theget_phone_infomethod:response=dialer.get_phone_info(phone_number)Each of these methods returns a JSON object containing the response from the Exotel server.Exotel Class - User MethodsThe Exotel class provides several methods for managing users on Exotel's dashboard.create_userCreates a new user on Exotel's dashboard.Parametersfirst_name (str): The first name of the user on Exotel's dashboard.last_name (str): The last name of the user on Exotel's dashboard.user_email (str): A unique and valid email ID of the user. If not set, the user will not be able to access Exotel's dashboard, but calls can be made via CCM APIs.user_phone (str): The phone number of the user. It should be in E.164 format. For VOIP users, this is optional (SIP device will be auto-created).role (str): The role of the user on Exotel's dashboard. Possible values are "admin", "supervisor", and "user". The default value is "user" (which is an agent with the lowest level of access permissions).get_user_detailsRetrieves the details of a single user, including their associated devices.Parametersuser_id (str): The ID of the user to retrieve.Returns(JSON): The response from the API request, containing the details of the user.Raises(Exception): If an error occurs while making the API request.update_userUpdates an existing user on Exotel's dashboard.Parametersuser_id(str): The ID of the user to update.data(dict): A dictionary containing the following fields to update:data={"first_name":FirstNameOfTheUser,"last_name":LastNameOfTheUser,"email":Thisisallowedonlyifemailwasn't configured during Create User API.,}Returns(JSON): The response from the API request, containing the updated details of the user.Raises(Exception): If an error occurs while making the API request.set_user_statusSets the availability status of a user on Exotel's dashboard.Parametersuser_id(str): The ID of the user to update.device_id(str): The ID of the device associated with the user.status(bool): The user's availability status (True for available, False for unavailable).user_phone(str): An optional string representing the user's phone number, in E.164 format, to update the device's contact URI.Returns(JSON): The response from the API request, containing the updated status of the user.Raises(Exception): If an error occurs while making the API request.delete_userDeletes a user from Exotel's dashboard.Parametersuser_id(str): The ID of the user to delete.Returns(JSON): The response from the API request, containing the details of the deleted user.Raises(Exception): If an error occurs while making the API request.get_all_usersGet All Users from Exotel's dashboard'Parametersfields (str, optional): A comma-separated list of fields to include in the response.
Valid values are: "devices", "active_call", and "last_login".
Default value is "devices,active_call,last_login"Returns(JSON): A list of dictionaries containing information about the users.Raises(Exception): If an error occurs while making the API request.NoteExotel's V3 API is currently in beta testing and is not yet supported by this SDK.SupportIf you have any questions or issues with PyExotel, please feel free to open an issue on theGitHub repository. I will do my best to assist you.ContributionIf you would like to contribute to PyExotel, please feel free to open a pull request on theGitHub repository. Your contributions are always welcome.