<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom Connector - Trigger passes test, Fails at recipe start in Workato Pros Discussion Board</title>
    <link>https://systematic.workato.com/t5/workato-pros-discussion-board/custom-connector-trigger-passes-test-fails-at-recipe-start/m-p/6953#M2994</link>
    <description>&lt;P&gt;omg nvm I got it sorted. Here is the corrected triggers block, for anyone interested:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  triggers: {
    new_event: {
      title: 'New Event',
      subtitle: 'Triggers when a new event occurs in Basecamp',
      description: 'Triggers when a specified event happens in Basecamp',

      input_fields: lambda do
        [
          {
            name: 'project_id',
            label: 'Project ID',
            type: 'string',
            optional: false,
            hint: 'ID of the Basecamp project to monitor for events'
          },
          {
            name: 'event_types',
            label: 'Event Types',
            type: 'string',
            control_type: 'text',
            optional: false,
            hint: 'No spaces allowed! Events to monitor (ex: ToDo,Todolist,Comment,Message,Upload)'
          }
        ]
      end,

      webhook_subscribe: lambda do |webhook_url, connection, input, recipe_id|
        response = post("https://3.basecampapi.com/#{connection['account_id']}/buckets/#{input['project_id']}/webhooks.json",
            payload_url: webhook_url)
      end,

      webhook_unsubscribe: lambda do |webhook, connection|
        delete("https://3.basecampapi.com/#{connection['account_id']}/buckets/#{webhook['project_id']}/webhooks/#{webhook['id']}.json")
      end,

      webhook_notification: lambda do |input, payload, extended_input_schema, extended_output_schema, headers, params|
        payload
      end,

      dedup: lambda do |event|
        event['id']
      end,

      output_fields: lambda do |object_definitions|
        object_definitions['event']
      end
    }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 23 Jun 2024 00:02:39 GMT</pubDate>
    <dc:creator>GrailAutomation</dc:creator>
    <dc:date>2024-06-23T00:02:39Z</dc:date>
    <item>
      <title>Custom Connector - Trigger passes test, Fails at recipe start</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/custom-connector-trigger-passes-test-fails-at-recipe-start/m-p/6952#M2993</link>
      <description>&lt;P&gt;Hi Friends — I need some help with the &lt;STRONG&gt;new_event&lt;/STRONG&gt; trigger in this custom connector. The trigger passes validation &amp;amp; testing done via the SDK development screen, but it throws a 400 error if I try to start a recipe with it.&lt;/P&gt;&lt;P&gt;Below are some screenshots and the code for the custom connector. API documentation &lt;A href="http://c66b5262e28245fd800c2a7662e69d515381f65d" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Is there any way for me to see the HTTP request Workato is making when I the trigger is executed? Any tips or words of encouragement appreciated&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Successful Test in Postman:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-06-22 at 3.42.11 PM.png" style="width: 999px;"&gt;&lt;img src="https://systematic.workato.com/t5/image/serverpage/image-id/1393i82FC50DF965CDEE3/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-06-22 at 3.42.11 PM.png" alt="Screenshot 2024-06-22 at 3.42.11 PM.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Successful Test in Workato:&lt;/STRONG&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pass.png" style="width: 999px;"&gt;&lt;img src="https://systematic.workato.com/t5/image/serverpage/image-id/1391i110621F616FB4E73/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="pass.png" alt="pass.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Failed Recipe:&lt;/STRONG&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fail.png" style="width: 999px;"&gt;&lt;img src="https://systematic.workato.com/t5/image/serverpage/image-id/1392i584598435B39BE7F/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="fail.png" alt="fail.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;{
  title: 'Basecamp',

  connection: {
    fields: [
      {
        name: 'client_id',
        label: 'Client ID',
        hint: 'You can find your client ID in your OAuth app settings',
        optional: false
      },
      {
        name: 'client_secret',
        label: 'Client Secret',
        hint: 'You can find your client secret in your OAuth app settings',
        optional: false,
        control_type: 'password'
      },
      {
        name: 'account_id',
        label: 'Account ID',
        hint: 'https://3.basecamp.com/XXXXXXX',
        optional: false,
        control_type: 'text'
      }
    ],
    authorization: {
      type: 'oauth2',
      client_id: lambda do |connection|
        connection['client_id']
      end,
      client_secret: lambda do |connection|
        connection['client_secret']
      end,
      authorization_url: lambda do |connection|
        "https://launchpad.37signals.com/authorization/new?type=web_server&amp;amp;client_id=#{connection['client_id']}&amp;amp;redirect_uri=https://www.workato.com/oauth/callback"
      end,
      acquire: lambda do |connection, auth_code, redirect_uri|
        response = post('https://launchpad.37signals.com/authorization/token').
          payload(
            type: 'web_server',
            code: auth_code,
            client_id: connection['client_id'],
            client_secret: connection['client_secret'],
            redirect_uri: redirect_uri
          ).
          request_format_www_form_urlencoded

        {
          access_token: response["access_token"],
          refresh_token: response["refresh_token"],
          expires_at: Time.now + response["expires_in"].to_i.seconds
        }
      end,
      refresh: lambda do |connection, refresh_token|
        response = post('https://launchpad.37signals.com/authorization/token').
          payload(
            type: 'refresh',
            refresh_token: refresh_token,
            client_id: connection['client_id'],
            client_secret: connection['client_secret']
          ).
          request_format_www_form_urlencoded

        {
          access_token: response["access_token"],
          refresh_token: response["refresh_token"],
          expires_at: Time.now + response["expires_in"].to_i.seconds
        }
      end,
      refresh_on: [401],
      apply: lambda do |_connection, access_token|
        headers('Authorization': "Bearer #{access_token}")
      end
    },
    base_uri: lambda do |connection|
      "https://3.basecampapi.com/#{connection['account_id']}/"
    end
  },

  triggers: {
    new_event: {
      title: 'New Event',
      subtitle: 'Triggers when a new event occurs in Basecamp',
      description: 'Triggers when a specified event happens in Basecamp',
      input_fields: lambda do
        [
          {
            name: 'project_id',
            label: 'Project ID',
            optional: false,
            hint: 'ID of the Basecamp project to monitor for events'
          },
          {
            name: 'event_types',
            label: 'Event Types',
            type: 'string',
            control_type: 'text',
            optional: false,
            hint: 'No spaces allowed! Events to monitor (ex: ToDo,Todolist,Comment,Message,Upload)'
          }
        ]
      end,
      webhook_subscribe: lambda do |webhook_url, connection, input, recipe_id|
        response = post("https://3.basecampapi.com/#{connection['account_id']}/buckets/#{input['project_id']}/webhooks.json",
            payload_url: webhook_url,
            types: input['event_types'].split(","))
      end,
      webhook_unsubscribe: lambda do |webhook, connection|
        delete("https://3.basecampapi.com/#{connection['account_id']}/buckets/#{webhook['project_id']}/webhooks/#{webhook['id']}.json")
      end,
      webhook_notification: lambda do |input, payload, extended_input_schema, extended_output_schema, headers, params|
        payload["data"]
      end,
      dedup: lambda do |event|
        event['id']
      end,
      output_fields: lambda do |object_definitions|
        object_definitions['event']
      end
    }
  },

  actions: {
    
  },
  
  object_definitions: {
    event: {
      fields: lambda do
        # removed for brevity
      end
    }
  }
  
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jun 2024 23:26:02 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/custom-connector-trigger-passes-test-fails-at-recipe-start/m-p/6952#M2993</guid>
      <dc:creator>GrailAutomation</dc:creator>
      <dc:date>2024-06-22T23:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Connector - Trigger passes test, Fails at recipe start</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/custom-connector-trigger-passes-test-fails-at-recipe-start/m-p/6953#M2994</link>
      <description>&lt;P&gt;omg nvm I got it sorted. Here is the corrected triggers block, for anyone interested:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  triggers: {
    new_event: {
      title: 'New Event',
      subtitle: 'Triggers when a new event occurs in Basecamp',
      description: 'Triggers when a specified event happens in Basecamp',

      input_fields: lambda do
        [
          {
            name: 'project_id',
            label: 'Project ID',
            type: 'string',
            optional: false,
            hint: 'ID of the Basecamp project to monitor for events'
          },
          {
            name: 'event_types',
            label: 'Event Types',
            type: 'string',
            control_type: 'text',
            optional: false,
            hint: 'No spaces allowed! Events to monitor (ex: ToDo,Todolist,Comment,Message,Upload)'
          }
        ]
      end,

      webhook_subscribe: lambda do |webhook_url, connection, input, recipe_id|
        response = post("https://3.basecampapi.com/#{connection['account_id']}/buckets/#{input['project_id']}/webhooks.json",
            payload_url: webhook_url)
      end,

      webhook_unsubscribe: lambda do |webhook, connection|
        delete("https://3.basecampapi.com/#{connection['account_id']}/buckets/#{webhook['project_id']}/webhooks/#{webhook['id']}.json")
      end,

      webhook_notification: lambda do |input, payload, extended_input_schema, extended_output_schema, headers, params|
        payload
      end,

      dedup: lambda do |event|
        event['id']
      end,

      output_fields: lambda do |object_definitions|
        object_definitions['event']
      end
    }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jun 2024 00:02:39 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/custom-connector-trigger-passes-test-fails-at-recipe-start/m-p/6953#M2994</guid>
      <dc:creator>GrailAutomation</dc:creator>
      <dc:date>2024-06-23T00:02:39Z</dc:date>
    </item>
  </channel>
</rss>

