Indigo API with Google Sheets (Example)

Posted on
Tue May 16, 2023 6:33 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Indigo API with Google Sheets (Example)

I wanted to share a Google Apps Script example I'm currently using. Google Sheets does not have a built in messaging function, so I created an Indigo. Action Group to send me an iMessage, and I use the following function to execute it.
Code: Select all

// Executes Indigo Action Group
// Takes Action Group ID as input
function executeActionGroup(actionId){

  // Things that are specific to your environment
  const REFLECTORNAME = "YOUR REFLECTORNAM HERE";
  const APIKEY = "YOUR API KEY HERE";
  const ACTIONGROUPID = actionId;  // an Indigo action group id

  // The message to send to the Indigo Server
  const message = JSON.stringify({
    "id": "optional message-id",
    "message": "indigo.actionGroup.execute",
    "objectId": ACTIONGROUPID
  });

  // These are options that you'll pass to the UrlFetchApp call
  const options = {
    method: "post",
    headers: {
      Authorization: `Bearer ${APIKEY}`,
      "Content-Type": "application/json"
    },
    payload: message
  };

  // Get the action group JSON from Indigo and log it to the console
 // This could use some error handling
  const response = UrlFetchApp.fetch(`https://${REFLECTORNAME}.indigodomo.net/v2/api/command`, options);
  const actionGroupInstance = JSON.parse(response.getContentText());
 
 //console.log(actionGroupInstance);

}

Posted on
Tue May 16, 2023 8:45 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Indigo API with Google Sheets (Example)

Sorry if I am being thick here, but is this reliant on the iMessage plugin (which I'm sure is great and it has great support but just didn't work for me)?

Posted on
Wed May 17, 2023 6:25 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: Indigo API with Google Sheets (Example)

mundmc wrote:
Sorry if I am being thick here, but is this reliant on the iMessage plugin (which I'm sure is great and it has great support but just didn't work for me)?


This is really an example of how to fire any Action Group through the Indigo API using Google Apps Script

Posted on
Fri May 19, 2023 8:43 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Indigo API with Google Sheets (Example)

ryanbuckner wrote:
mundmc wrote:
Sorry if I am being thick here, but is this reliant on the iMessage plugin (which I'm sure is great and it has great support but just didn't work for me)?


This is really an example of how to fire any Action Group through the Indigo API using Google Apps Script
Thank you for giving me the concreteness I needed!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests