Kaizen #106 - Functions and Invoke URLs - Part 2

Kaizen #106 - Functions and Invoke URLs - Part 2

Hello everyone! Welcome to Kaizen #106.
In continuation to our last post, today, we will discuss invoke URLs in functions, how they are different from integration tasks, and how authentication works for them.

What are invokeURL tasks?

invokeUrl task is a task designed to trigger HTTP API endpoints of Zoho apps or any external services. invokeUrl makes the authorization part much easier by setting up connectors.

How are invoke URLs authenticated?

Using Connections.
Connections allow you to connect to various third-party apps or other Zoho services. Connections essentially use the OAuth 2.0 protocol. It abstracts the entire OAuth2.0 authorization flow and keeps your code simple, clean, and crisp.
If you set up a connection once, and authorize it once, you can make API calls to and from the external system and Zoho CRM.
You can create a single connection for your org and other users of your org can use the same connection by authenticating it with their credentials. Other users of your org can use your connection. In such cases, your connection will appear as a "shared connection" in their accounts.
Similarly, if you use your credentials to authenticate a connection created by some other user, it will be listed under the "shared connections" of your account.
For more details on types of connections, refer to this page.

Default Services

Zoho CRM has integrated with various third-party apps and they are listed under Default Services. All you have to do is
  1. Go to Setup > Developer Space > Connections > Create Connection.
  2. Under "Pick your service", choose the app you want to connect to. Here, I have chosen Gsheet.
  3. Click Create Connection.
  4. Specify the Connection Name and choose the scopes from the list. Note that this will vary based on the service you choose.

  5. Click Create and Connect.
  6. You will be redirected to a screen asking for your consent to connect to the service.
  7. Provide your login credentials.
  8. Click Connect. You will be redirected to Zoho Flow's authentication page, asking for your consent to connect to the service and redirect you to the service's login page.

  9. On the service's login page, provide your credentials and login.
  10. The service shows a pop up explaining the data that Zoho flow will use through the connection.

  11. Click Allow.
  12. The connection will be created in Zoho CRM.

  13. The sample code contains the snippet of the invoke URL you must use in your function to use the Gsheet's endpoints.
By simply using the connection name in your code, you can connect to third-party apps without worrying about token generation or configuration.

Components of the invoke URL

url - The third party's API endpoint you want to access.
type - The type of API call it is going to be. Supports GET, POST, PUT and DELETE.
parameters - The body of the request.
connection - The name of the connection you want to use.
For more details on invoke URL task, refer to this page.

Custom Service

Use this option when the service you want to connect to is not listed under "Default Services".
To create a custom service and connect to it, you must give the details of the service like its name, authorization type, and other attributes, and take care of token generation.


Differences between integration tasks and invoke URLs

Integration Tasks
Invoke URLs
API wrappers to Zoho APIs. Can be called just like built-in functions.
HTTP requests that are triggered explicitly.
All integration task actions are triggered under the admin’s authorization.
All invokeUrl actions that are triggered pertain to the user that authorized the connection.

Here is a sample of a function using invoke URL and the connection named "mine".

headermap = map();
headermap.put("this goes in the header", "value");
paramMap = map();
paramMap.put("this goes in the body", "body");
info paramMap;
response = invokeUrl [
type: POST
headers: headermap
content-type: "application/json"
parameters: paramMap.toString()
connection: "mine"
];
info response;
return "";

Here is the response.


As you can see, as the connection is already authenticated using OAuth2.0, the connection directly supplies the access token.
We hope you found this post useful. Let us know what you think in the comments, or email us at support@zohocrm.com.

Cheers!




    Access your files securely from anywhere









                          Zoho Developer Community




                                                • Desk Community Learning Series


                                                • Digest


                                                • Functions


                                                • Meetups


                                                • Kbase


                                                • Resources


                                                • Glossary


                                                • Desk Marketplace


                                                • MVP Corner


                                                • Word of the Day


                                                • Ask the Experts



                                                          • Sticky Posts

                                                          • Kaizen #217 - Actions APIs : Tasks

                                                            Welcome to another week of Kaizen! In last week's post we discussed Email Notifications APIs which act as the link between your Workflow automations and you. We have discussed how Zylker Cloud Services uses Email Notifications API in their custom dashboard.
                                                          • Kaizen #216 - Actions APIs : Email Notifications

                                                            Welcome to another week of Kaizen! For the last three weeks, we have been discussing Zylker's workflows. We successfully updated a dormant workflow, built a new one from the ground up and more. But our work is not finished—these automated processes are
                                                          • Kaizen #152 - Client Script Support for the new Canvas Record Forms

                                                            Hello everyone! Have you ever wanted to trigger actions on click of a canvas button, icon, or text mandatory forms in Create/Edit and Clone Pages? Have you ever wanted to control how elements behave on the new Canvas Record Forms? This can be achieved
                                                          • Kaizen #142: How to Navigate to Another Page in Zoho CRM using Client Script

                                                            Hello everyone! Welcome back to another exciting Kaizen post. In this post, let us see how you can you navigate to different Pages using Client Script. In this Kaizen post, Need to Navigate to different Pages Client Script ZDKs related to navigation A.
                                                          • Kaizen #210 - Answering your Questions | Event Management System using ZDK CLI

                                                            Hello Everyone, Welcome back to yet another post in the Kaizen Series! As you already may know, for the Kaizen #200 milestone, we asked for your feedback and many of you suggested topics for us to discuss. We have been writing on these topics over the


                                                          Manage your brands on social media



                                                                Zoho TeamInbox Resources



                                                                    Zoho CRM Plus Resources

                                                                      Zoho Books Resources


                                                                        Zoho Subscriptions Resources

                                                                          Zoho Projects Resources


                                                                            Zoho Sprints Resources


                                                                              Qntrl Resources


                                                                                Zoho Creator Resources



                                                                                    Zoho CRM Resources

                                                                                    • CRM Community Learning Series

                                                                                      CRM Community Learning Series


                                                                                    • Kaizen

                                                                                      Kaizen

                                                                                    • Functions

                                                                                      Functions

                                                                                    • Meetups

                                                                                      Meetups

                                                                                    • Kbase

                                                                                      Kbase

                                                                                    • Resources

                                                                                      Resources

                                                                                    • Digest

                                                                                      Digest

                                                                                    • CRM Marketplace

                                                                                      CRM Marketplace

                                                                                    • MVP Corner

                                                                                      MVP Corner







                                                                                        Design. Discuss. Deliver.

                                                                                        Create visually engaging stories with Zoho Show.

                                                                                        Get Started Now


                                                                                          Zoho Show Resources

                                                                                            Zoho Writer

                                                                                            Get Started. Write Away!

                                                                                            Writer is a powerful online word processor, designed for collaborative work.

                                                                                              Zoho CRM コンテンツ






                                                                                                Nederlandse Hulpbronnen


                                                                                                    ご検討中の方