# How to Add Multiple Tags to New/Existing Contacts via Webhook Handler Script?

**URL:** <https://forum.mautic.org/t/how-to-add-multiple-tags-to-new-existing-contacts-via-webhook-handler-script/18078>\
**Category:** Product Support\
**Created:** [February 8, 2021, 1:58am UTC](https://forum.mautic.org/t/how-to-add-multiple-tags-to-new-existing-contacts-via-webhook-handler-script/18078 "2021-02-08T01:58:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![monkeyjedi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/monkeyjedi/32/543_2.png) [@monkeyjedi](https://forum.mautic.org/u/monkeyjedi)\
**Post date:** [February 8, 2021, 1:58am UTC](https://forum.mautic.org/t/how-to-add-multiple-tags-to-new-existing-contacts-via-webhook-handler-script/18078/1 "2021-02-08T01:58:08Z")

</div>

**Your software**  
My Mautic version is: The latest

My PHP version is: 7.4

My Database type and version is: MySQL, latest

**Your problem**  
My problem is:

I have a php webhook handler script that maps data from a Memberpress webhook to Mautic. I need to know two things.

1. How do I add more than one tag? Mautic documentation does not explain this. Here’s some sample code:

// Grab Data values  
$email = $data[‘data’][‘email’];  
$firstname = ($data[‘data’][‘first\_name’] == ‘’)?$data[‘data’][‘username’]:$data[‘data’][‘first\_name’];  
$lastname = $data[‘data’][‘last\_name’];  
$username = $data[‘data’][‘username’];  
$tag = ‘MP Hook’;  
$address1 = $data[‘data’][‘address’][‘mepr-address-one’];  
$address2 = $data[‘data’][‘address’][‘mepr-address-two’];  
$city = $data[‘data’][‘address’][‘mepr-address-city’];  
$state = $data[‘data’][‘address’][‘mepr-address-state’];  
$zip = $data[‘data’][‘address’][‘mepr-address-zip’];  
$country = $data[‘data’][‘address’][‘mepr-address-country’];  
$stage = 1;  
$practice\_squad = $data[‘type’];

and…

// Posting the Data  
CURLOPT\_POSTFIELDS =\> array(  
‘firstname’ =\> $firstname,  
‘lastname’ =\> $lastname,  
‘username’ =\> $username,  
‘email’ =\> $email,  
‘address1’ =\> $address1,  
‘address2’ =\> $address2,  
‘city’ =\> $city,  
‘state’ =\> $state,  
‘zip’ =\> $zip,  
‘country’ =\> $country,  
‘tags’ =\> $tag,  
‘practice\_squad’ =\> $practice\_squad,  
‘stage’ =\> $stage  
)  
));

$resp = curl\_exec($curl);  
curl\_close($curl);

Thanks.

---

<div class="post-metadata">

**Author:** ![coachieving](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/coachieving/32/5139_2.png) [@coachieving](https://forum.mautic.org/u/coachieving)\
**Post date:** [May 7, 2021, 4:48am UTC](https://forum.mautic.org/t/how-to-add-multiple-tags-to-new-existing-contacts-via-webhook-handler-script/18078/2 "2021-05-07T04:48:59Z")

</div>

Did you try to do it via a comma separated list? Like $tag = ‘MP Hook, MD Hook, MB Hook’;
