How to write webform settings and conditions programmatically
I had a similar requirement :

The site will have some landing page contents and the site owner can add those contents at different times, and once a content of type landing_pages will be created some blocks (already created) will get enabled on that node details page and a new webform node with some predefined fields will get created and get enabled as a block on that page in particular places.

I did it in D6.

My approach for the dynamic webform block :


I created a webform node with all the default &amp; predefined fields, say with nid = 100
Enabled 'Available as block' option by visiting 'Form settings' tab in the path 'node/100/webform/configure'
Created a custom module 'landing_pages'
I cloned the nid = 100, each time a new landing_pages content is created
In hook_init() used this code :


/**
 *Implementation of hook_init(). 
 */
function landing_pages_init() {
// Update the 'blocks' DB table with the blocks currently exported by modules.
_block_rehash( $theme = NULL );
}

In hook_node_api() used this code :


/**
 *Implementation of hook_node_api().
 */
function landing_pages_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
 switch ($op) {
   case 'insert' :
     if ($node->type == 'landing_pages') {
       $node_id = 100;
       // function to create & save the clone node              
       $new_nid = clone_node_save_custom( $node_id, $node->title );
     }
   break;
   case 'load' :
     if ($node->type == 'landing_pages') {
       /*updating webform block*/
       $result2 = db_fetch_object( db_query( "SELECT n.nid , n.title FROM {node} n WHERE n.type = 'webform' ORDER BY n.nid DESC LIMIT 1" ) );
       $var_result2 = 'client-block-' . $result2->nid;
       $result3 = db_result( db_query( "SELECT b.bid FROM {blocks} b WHERE b.module = 'webform' ORDER BY b.bid DESC LIMIT 1" ) );
       $nid = $node->nid; // Can avoide this step & directly use $node->nid
       $var_result1 = 'node/' . $nid;
       $check1 = db_query( "SELECT bl.bid FROM {blocks} bl WHERE bl.pages LIKE '$nid' AND bl.module = 'webform'" );
       /*if blocks table doesn't have any entry for 'pages' like this 'nid'*/
       if (db_affected_rows() == 0) {
         $check2 = db_fetch_object( db_query( "SELECT b.bid, b.region, b.status, b.visibility, b.pages FROM {blocks} b WHERE b.delta LIKE '$var_result2'" ) );
         /*if blocks table doesn'thave any entry for 'delta' like '$var_result2'*/
         if (db_affected_rows() != 0) {
           /*if blocks table doesn't have any entry for 'region' & pages,0 as entry for 'status' & visibility*/
           if ($check2->region == '' && $check2->status == 0 && $check2->visibility == 0 && $check2->pages == '') {
             $exp = explode( '-#-', $result2->title );
             if ($exp[0] != '')
               $title = $exp[1];
               db_query( "UPDATE {blocks} b SET b.module = 'webform', b.delta = '%s', b.theme = 'YOUR_THEME_NAME', b.status = 1, b.region = 'sidebar_second', b.visibility = 1, b.pages = '%s', b.title = '%s' WHERE b.bid = %d", $var_result2, $var_result1, $title, $result3 );
             }
           }
         }
       }
    break;
    case 'delete' :
      if ($node->type == 'landing_pages') {
        $res = db_query( "SELECT b.bid, b.delta FROM {blocks} b WHERE b.module IN ('webform' , 'block') AND b.theme = 'YOUR_THEME_NAME' AND b.pages LIKE 'node/$node->nid'" );
        while ( $row = db_fetch_object( $res ) ) {
          if (! is_numeric( $row->delta )) {
            $exp = explode( 'client-block-', $row->delta );
            if ($exp[0] == '' && is_numeric( $exp[1] )) {
            //This validation can be skipped
              $type = db_result( db_query( "SELECT n.type FROM {node} n WHERE n.nid = %d", $exp[1] ) );
              if ($type == 'webform') {
                node_delete( $exp[1] );
            }
          }
        }
        else {
          db_query( "DELETE FROM {blocks} WHERE bid = %d", $row->bid );
          db_query( "DELETE FROM {boxes} WHERE bid = %d", $row->delta );
        }
      }
    }
    break;
 }
}

Supporting functions :

  
/**
 *Definition of clone_node_save_custom(). 
 */
function clone_node_save_custom($nid, $nodetitle) {
 if (is_numeric( $nid )) {
   global $user;
   $node = node_load( $nid );
   if (isset( $node->nid ) && clone_is_permitted( $node->type )) {
     $original_node = drupal_clone( $node );
     $node->nid = NULL;
     $node->vid = NULL;
     $node->tnid = NULL;
     $node->name = $user->name;
     $node->uid = $user->uid;
     $node->created = NULL;
     $node->menu = clone_node_clone_menu_link( $original_node );
     $node->book['mlid'] = NULL;
     $node->path = NULL;
     $node->files = array();
     $node->title = t( '!tit -#- !title', array('!tit' => $nodetitle, '!title' => $node->title ) );
     $node->clone_from_original_nid = $original_node->nid;

 if (variable_get( 'clone_reset_' . $node-&gt;type, FALSE )) {
   $node_options = variable_get( 'node_options_' . $node-&gt;type, array('status', 'promote' ) );
   foreach ( array('status', 'moderate', 'promote', 'sticky', 'revision' ) as $key ) {
     $node-&gt;$key = in_array( $key, $node_options );
   }
 }
 drupal_alter( "clone_node", $node, $original_node, "save-edit" );
 node_save( $node );
 return $node-&gt;nid;


  }
}
}



/**
*Defines clone_node_clone_menu_link()
*@param $node
*/
function clone_node_clone_menu_link($node) {
if (variable_get( 'clone_menu_links', FALSE )) {
  // This will fetch the existing menu link if the node had one.
  node_invoke_nodeapi( $node, 'prepare' );
  if (! empty( $node->menu['mlid'] )) {
    $old_link = $node->menu;
    $link['link_title'] = t( 'Clone of !title', array('!title' => $old_link['link_title'] ) );
    $link['plid'] = $old_link['plid'];
    $link['menu_name'] = $old_link['menu_name'];
    $link['weight'] = $old_link['weight'];
    return $link;
  }
}
return NULL;
}

Theme used is ZEN
Region I needed the webform be enabled is 'sidebar_second'
We shall have control over the settings of each webform for each Landing Page


Hope it helps.