create drupal 7 webform programmatically? I have already created a webform and I need to fill it programatically.

how can I create webform ? Can i create it like node creation:

$node = new stdClass()
$node-&gt;type = 'webform'
$node-&gt;webform['components'][1]['value'] =  'sss'
See code below:

function _add_webform_components($node) {
  $components = array(
    0 =&gt; array(
      'name' =&gt; 'First name',
      'form_key' =&gt; 'first_name',
      'type' =&gt; 'textfield',
      'mandatory' =&gt; 1,
      'weight' =&gt; 1,
      'pid' =&gt; 0
    ),
    1 =&gt; array(
      'name' =&gt; 'Name',
      'form_key' =&gt; 'name',
      'type' =&gt; 'textfield',
      'mandatory' =&gt; 1,
      'weight' =&gt; 2,
      'pid' =&gt; 0
    ),
    ... and so on

  );

  webform_ensure_record($node);
  foreach($components as $component) {
    $component['nid'] = $node-&gt;nid;
    $component['extra']['title_display'] = 'inline';
    $node-&gt;webform['components'][] = $component;
    webform_component_insert($component);
  }
  $email = array(
    'nid' =&gt; $node-&gt;nid,
    'email' =&gt; 'name@example.ch',
    'subject' =&gt; 'default',
    'from_name' =&gt; 'default',
    'from_address' =&gt; 'default',
    'template' =&gt; 'default',
    'excluded_components' =&gt; array(),
  );
  webform_email_insert($email);
}