Salesforce has agreed to buy Braze for about $5.66 billion in cash, paying $47.50 a share, a 58.1% premium.