Webhooks and API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • emmaenoh
    Junior Member
    • May 2020
    • 12

    Webhooks and API

    I have develop a solution on Tax Management on espo CRM, but I need to sent some data field from my account interface to another application, pls what could be the best possible way to achieve. have been on it for over a month without any possible solution. Tried using webhooks and create an API user yet could not achieve it, although I have little Experince on programing,
  • telecastg
    Active Community Member
    • Jun 2018
    • 907

    #2
    Could you be more specific on what are you trying to accomplish ?

    If you want Espo to send information to an outside application when something happens at Espo, then you need to create a Webhook in Espo https://docs.espocrm.com/administration/webhooks/ to send the information to the outside application and create a "listener" of some type in that application to react to the information received from the webhook.

    If you want Espo to do something (view, create, update, delete, etc) when an event occurs in your outside application, then you need to write an API call at your external application to Espo, when something happens there ( https://forum.espocrm.com/forum/deve...46-api-example or https://docs.espocrm.com/development/api-tutorial/ ) and the code to react to the results of the API call.
    Last edited by telecastg; 07-26-2020, 08:53 PM. Reason: Clarified what the external application API call script does

    Comment

    • emmaenoh
      Junior Member
      • May 2020
      • 12

      #3
      Thanks alot for your response, we captured enumeration data for tax payers, we intend sending some fields to another application using API to enable them generate assessment

      Comment

      • telecastg
        Active Community Member
        • Jun 2018
        • 907

        #4
        In that case you will need to write the API call to Espo in your external application (see the example that I posted here: https://forum.espocrm.com/forum/deve...46-api-example )

        The example shows how to make a call to create an entity/record (Contact) but in your case you probably want to retrieve the information about a specific entity/record or a list of entity/records so for example to get a list of Opportunities you would need to change this line:
        Code:
        $reponse = $client->request('POST', 'Contact', $new_contact_data);
        to something like this:

        Code:
        $response = $client->request('GET', 'Opportunity', [
            'maxSize' => 10,
            'select' => 'id, name,assignedUserId',
            'orderBy' => 'createdAt',
            'order' => 'desc',
            'primaryFilter' => 'open', ]);
        The above statement is telling Espo to return a list of 10 Opportunities that have a "stage" different than "won" or "lost", displaying the fields "id", "name" and "assignedUserId", sorted by the field "createdAt" from the newest to the oldest.

        I don't have experience writing complex API calls but you can learn about the different API functions in the documentation. https://docs.espocrm.com/development/api/#rest-api

        The key part is that you will need to write this code in your external application to retrieve the data from Espo.

        Comment

        • emmaenoh
          Junior Member
          • May 2020
          • 12

          #5
          I am about losing a project I started with espo crm bcus of integration, I was unable to pull up data from another application for Tax No Verification on espo crm, and sending my assessment report back to the software, it was actually difficult for me integrating with a third party software

          Comment

          • emillod
            Active Community Member
            • Apr 2017
            • 1405

            #6
            emmaenoh,
            i think i understand your problem.

            telecastg propose correct way of handle that kind of situations. One way is sending data from espocrm through POST. Another one is fetching information from espocrm through api remotly.
            I'm not sure how your application is working but after you send information to espo, you can read response from espocrm api and use parameters which will come back from espocrm.

            And even if you don't have sufficient information, you can send another request to gather specific information.

            Comment

            Working...