Webhook Tutorial - Send an Email!

You mean something like this?

int Alarm1 = D4; // high float will be connected to pin d2 on the unit
int highlevellight = D7;
bool isArmed = true;

int rearm(String dmy)
{
  isArmed = true;
  return 0;
}

void setup() 
{
  Particle.function("rearmAlarm", rearm);

  pinMode(Alarm1, INPUT_PULLDOWN);
  pinMode(highlevellight, OUTPUT);// declare the highlevellight pin as an output
}

void loop() 
{
  bool state = !digitalRead(Alarm1);  // invert active LOW to more intuitive active HIGH
  if (isArmex && state)
  {
    isArmed = false;  // don't trigger till rearmed
    Particle.publish("EVENT_PREFIX", PRIVATE);
  } 
  digitalWrite(highlevellight, state);
}

Here you can find some formatting hints
Forum Tips and Tricks