monojohnny
monojohnny

Reputation: 6181

ifttt "Maker" Recipe: Optional Parameters are blank?

I am using the following Python Script to trigger a 'Maker' event on 'ifttt' like this:

import requests
from main import get_ifttt

def trigger_event(  event, key, json_data={} ):
    ca_certs = "/etc/ssl/certs/ca-certificates.crt"  
    url="https://maker.ifttt.com/trigger/%s/with/key/%s"%(event, key)
    r=requests.post( url, data=json_data, verify=ca_certs )
    assert(r.status_code==200)

if __name__=='__main__':
    trigger_event( 'calendar', get_ifttt(), "{ 'Value1': 'something' }" )

The ifttt Recipe creates a google calendar entry: using the text as follows:

{{OccurredAt}} "{{EventName}}" occurred on the Maker Channel : Value1: "{{Value1}}"

The Calendar event is created correctly ; but the 'Value1' string is blank? So the entry looks like this:

"calendar" occurred on the Maker Channel : Value1: ""

This also happens if I switch to a 'Notify' event as well ?

I have also tried using a 'curl' commandline with '?Value=xxx' appended; this also doesn't work.

I have tried using 'Value1' and 'value1': but same result.

What am I doing wrong here ?

(The code makes a call to a method called 'get_ifttt' : this just returns my secret API key).

Upvotes: 0

Views: 1306

Answers (1)

Junpei Tajima
Junpei Tajima

Reputation: 310

You can send 'value1' string by specifying Content-Type.

r=requests.post( url, data=json_data, verify=ca_certs, headers={'Content-Type': 'application/json'} )

Also you should use 'value1' instead of 'Value1'.

trigger_event( 'calendar', get_ifttt(), "{ 'value1': 'something' }" )

Upvotes: 4

Related Questions