How do I programatically add a Node to an Organic Group in Drupal 7? This question and the documentation would suggest that the og_group function is the way to achieve this; however, calling og_group thus:

$values = array('entity_type' =&gt; 'node', 'entity' =&gt; $node);
og_group($gid, $values);
node_save($node);


Does not update the group_audience field on the node. 

I'm referring to 7.x-1.3 of the og module; currently the only stable release on D7.

How can I go about programmatically adding a node to a group?

Thanks in advance.
Try og_set_association() its listed under their API section of og.module

I have done this in the past with D7, but I believe the API I used has changed since then.