Connect Quick Start Guide
Prerequisites:
- A service on IFTTT with valid user authentication. Get started quickly with Doorkeeper (Ruby), Authlib (Python), or any other OAuth 2 provider.
1) Choose which services you would like to connect
You may already have a service in mind that you would like to connect to yours. In this example, we're going to build a connection that enables you to add events to Google Calendar on behalf of your users.
Your connection powers an embeddable integration between your service and another service:
2) Build your connection
Create a new connection and search for and add the Google Calendar service, then click Continue.
Add a new feature, then configure it to include the following:
While planning your connections, it's important to consider the relationship between triggers, queries, and actions. Here, an example illustrates a connection's feature enabling Google Calendar to "Effortlessly track time spent at work":
Learn more about using the connection creation tool here.
3) Enable your connection
Click on Want to test or use this connection yourself? Enable it on IFTTT, and enable the connection.
Head back to your connection's page on the platform, and view the API logs. You should see one event in the logs:
POST /ifttt_developers/ifttt/v1/webhooks/connection/enabled
This likely resulted in a 404
. That's to be expected unless you've set up the connection enabled webhook. As you can see, that webhook will be fired anytime a user enables your connection.
4) Test the trigger, query, and action
Take note of the connection ID, your user ID, and your IFTTT service key to use in the following requests. You can also find curl
commands on your connection's page which you can copy/paste into a command line.
Test the Any event starts trigger
The /test
endpoint simulates an event that would send a request to the webhook endpoint you'll build later. In this example, sending a valid request to the /test
endpoint would simulate an event starting for the user who has enabled your connection.
-
HTTP Request
POST /v2/connections/{{YourConnectionID}}/triggers/google_calendar.any_event_starts/test?user_id={{YourUserID}} Host: connect.ifttt.com IFTTT-Service-Key: {{YourServiceKey}} {}
-
Expected response
HTTP/1.1 204 No Content Status: 204 No Content
Test the List Events For a Date Range query
This query will return a JSON object consisting of the Google Calendar events in the date range provided on the calendar you selected when you enabled the connection above.
-
HTTP Request
POST /v2/connections/{{YourConnectionID}}/queries/google_calendar.list_events_for_date_range/perform?user_id={{YourUserID}} Host: connect.ifttt.com IFTTT-Service-Key: {{YourServiceKey}} { "fields": { "start_date": "2020-01-01", "end_date": "2020-01-05" } }
-
Expected response
{ "type": "list", "data": [{ "event_id": "2fkfq7gs2q7779sh4jfn0oqed8", "title": "Test!", "description": "", "location": "", "event_start": "2020-02-01T19:00:00.000Z", "event_end": "2020-02-01T19:30:00.000Z", "event_url": "https://www.google.com/calendar/event?eid=N3FzZnFuZGo3a3EwZjlzNDcyOGZnb2gyN2Uga2V2aW5AaWZ0dHQuY29t", "hangouts_url": null, "created_at": "2020-02-27T18:39:53.000Z", "attendees": { "type": "query", "query_id": "google_calendar.list_attendees", "fields": { "calendar": "GAwRPru0NDARdGQFAHAQsbslltHmdmLOQAlmA5gGvy", "event": "2fkfq7gs2q7779sh4jfn0oqed8" } } }] }
Run the Quick add event action
This action will create a Google Calendar event on the calendar you selected when you enabled the connection above.
-
HTTP Request
POST /v2/connections/{{YourConnectionID}}/actions/google_calendar.quick_add_event/run?user_id={{YourUserID}} Host: connect.ifttt.com IFTTT-Service-Key: {{YourServiceKey}} {}
-
Expected response
HTTP/1.1 204 No Content Status: 204 No Content
5) Test out the authentication flow as a new user
First, build your Connect URL. You can start with:
https://ifttt.com/connect/{connection_id}?email={your-email@address.com}
Then, sign out of any relevant accounts (or open in Incognito window) and visit the URL you built. You'll be walked through the authentication as a new user.
6) Summary
Now you have ability to interact with your users' Google Calendar events via an IFTTT connection. You've tested a trigger, query, and action and are familiar with the authentication flow and the requests/responses involved. Great work!
Next steps:
- Learn more about the Connect Button SDKs for iOS and Android.
- Read more about connections and configuring the connection creation tool.
- Explore the Service API to build triggers, queries, and actions that other services can interact with.