Not able to create/view expenses/reports of an employee in the same domain.

Preethu
Preethu Expensify Customer Posts: 4 Expensify Newcomer

Hi,

We are trying to integrate Expensify with our application. What we need to do for handling/view the expenses created by of our organization employees? For now I'm able to create/view the expense and reports of my own account. While trying to create for another employee mail it's throwing {'responseMessage': 'Not authorized to authenticate as user h****@foundingminds.com', 'responseCode': 401}.

Please do help me to resolve this issue.

Comments

  • Sonia Liapounova
    Sonia Liapounova Expensify Success Coach - Admin, Expensify Team Posts: 211 Expensify Team

    Hi @Preethu thanks for reaching out! A few questions for you,

    • Could you tell me what you're integrating with?
    • How are you creating employees?
    • Where are you seeing this error message?
  • Preethu
    Preethu Expensify Customer Posts: 4 Expensify Newcomer

    Hi,

    • We have a web application (Python Django is used in backend). I am trying to integrate that application with expensify expense API. The code used is given below.

    expense_data = requests.post(

    url="https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations",

    data = {

    'requestJobDescription':

    '{ "type":"create", "credentials":{ "partnerUserID":%s, "partnerUserSecret":%s}, "inputSettings":{ "type":"expenses", "employeeEmail":%s, "transactionList": [ { "created": %s, "currency": %s, "merchant": %s, "amount": %s, "category": %s, "externalID": %s, "comment": %s } ] } }' %(partnerUserID, partnerUserSecret, admin_email, data['created'], data['currency'], data['marchant'], data['amount'], category, data['bill_number'], data['comment'])

    }

    )

    response_data = expense_data.json()

    • We are now in testing stage, not moved to production. We are adding employees through our application.
    • I am getting this error in the response data. While testing through postman application.


    What we actually need is a organisation based integartion. So that the employees can create expense through our application. For now it's only taking my mail id for the given partnerUserID and partnerUserSecret.

    Do we have an option to add/link the employees in Expensify?

  • Sonia Liapounova
    Sonia Liapounova Expensify Success Coach - Admin, Expensify Team Posts: 211 Expensify Team

    @Preethu thank you for the insight!

    I take it h****@foundingminds.com is not your email address, is that correct?

    The API is not meant to be used by each individual user. The intention behind the API is for an admin to be able to make changes, for example invite users into Expensify or add expenses. It sounds to me like you're trying to have an employee use the API to create an expense, this can't be done. You will need to either invite the user to your Expensify policy so that they can enter their expenses via their Expensify account, or you can set up API import of expenses on the behalf of your users.

    • If you are looking to invite employees into your Expensify policy, please reference this API documentation.
    • Information on how you can add expenses into the Expensify accounts of your users, please reference this API documentation.
  • Preethu
    Preethu Expensify Customer Posts: 4 Expensify Newcomer

    Hi @Sonia Liapounova,

    Thanks for sharing the links.

    h****@foundingminds.com is not my mail id it's my colleague's.

    I tried to add employees into the policy. Not able to integrate advance employee updater API. It throwing employee data not found 410 error

    I am using python request for api call

    expense_data = requests.post(

    url = 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations',

    data = {

    'requestJobDescription': '{ "type": "update", "dry-run" : false, "credentials": { "partnerUserID": %s, "partnerUserSecret": %s }, "dataSource" : "request", "inputSettings": { "type": "employees", "entity": "generic" }, "onFinish":[ {"actionName": "email", "recipients": %s} ] }' %(partnerUserID, partnerUserSecret, admin_email),

    "Employees": "/home/preethu/FMS/EZWorks/Python/expensify/employee.json"

    }

    )


    • I am not sure how to pass the employee json file in this request. What I does is, saved the employee data in a json and passing the file path
    • In expensify there is domain - > domain members for adding the employees. What is it actually doing? If we add our employees there can they be able to create expense through our application?
  • Sonia Liapounova
    Sonia Liapounova Expensify Success Coach - Admin, Expensify Team Posts: 211 Expensify Team

    Hi @Preethu thanks for your patience, engineering took a look and they think the error you're seeing is due to access.

    Could you please send a message to Concierge either via chat or email (concierge@expensify.com) asking to be whitelisted for the advanced API? You can reference this community post comment - link in your reach out to Concierge to make sure your request is understood.