• Hi I want use your plugin to do this:
    a bot that “manage” a restaurant booking in simple way, the user ask to booking with a simple workflow:

    bot: hi, how many persons do u need the table reservation?
    user: 3
    bot: ok, what time?
    user 20:00
    bot: ok I book 4 you

    when the bot “book for you” an email is sent to a specific address with user phone number the time and number of person attached in the mail.

    is it possible?

    if yes can you give me a suggest

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter gnappo

    (@gnappo)

    Hey can you help me ? ??

    Thread Starter gnappo

    (@gnappo)

    I see that telegram bot api doesn’t allow to retrieve phone number, but I can ask to the user to insert it, how can I grab the conversation (from a point to another) and send an email?

    Thread Starter gnappo

    (@gnappo)

    I have used this snippet

    add_action('telegram_parse','telegramcustom_parse', 10, 2);
    
    function telegramcustom_parse( $telegram_user_id, $text ) {
        $plugin_post_id = telegram_getid( $telegram_user_id );
    
        if ( !$plugin_post_id ) {
            return;
        }
    
        if ( get_post_meta( $plugin_post_id, 'telegram_custom_state', true ) == 'tablenumber_wait' ) {
            if ( is_numeric( $text) && $text < 30	 ) { 
                $table = sanitize_text_field( $text );
                update_post_meta( $plugin_post_id, 'telegram_custom_tablenumber', $table );
                delete_post_meta( $plugin_post_id, 'telegram_custom_state' ); //Or set "telegram_custom_state" to something else
                die(); //You can comment this if you want to parse other commands
            } else {
                telegram_sendmessage( $telegram_user_id, 'Numero troppo alto. Per quante persone vuoi prenotare?');
                die(); //You can comment this if you want to parse other commands
            }
        } else if ( !get_post_meta( $plugin_post_id, 'telegram_custom_tablenumber' ) ) {
            telegram_sendmessage( $telegram_user_id, 'Per quante persone vuoi prenotare?');
            update_post_meta( $plugin_post_id, 'telegram_custom_state', 'tablenumber_wait' );
            die(); //You can comment this if you want to parse other commands
        }
    
        return;
    }
    

    to insert how many person book the restaurant table but it works immediately when u add the bot instead I want linked to a command and when your”telegram_custom_tablenumber” is filled is stopped to work, It work again after I delete the custom field in the subscriber page details

    I need also to add other 2 question, like insert your phone number and when book the table can you help me?

    thanks

    Thread Starter gnappo

    (@gnappo)

    I have changed the code in that way:

    add_action('telegram_parse','telegramcustom_parse', 10, 2);
    
    function telegramcustom_parse( $telegram_user_id, $text ) {
        $plugin_post_id = telegram_getid( $telegram_user_id );
    
        if ( !$plugin_post_id ) {
            return;
        }
        
        if ( $text == 'Prenota') {
    	
        if ( get_post_meta( $plugin_post_id, 'telegram_custom_state', true ) == 'tablenumber_wait' ) {
            if ( is_numeric( $mytext) && $mytext< 30	 ) { 
                $table = sanitize_text_field( $mytext );
                update_post_meta( $plugin_post_id, 'telegram_custom_tablenumber', $table );
                delete_post_meta( $plugin_post_id, 'telegram_custom_state' ); //Or set "telegram_custom_state" to something else
                die(); //You can comment this if you want to parse other commands
            } else {
                telegram_sendmessage( $telegram_user_id, 'Numero troppo alto. Per quante persone vuoi prenotare?');
                die(); //You can comment this if you want to parse other commands
            }
        } else if ( !get_post_meta( $plugin_post_id, 'telegram_custom_tablenumber' ) ) {
            telegram_sendmessage( $telegram_user_id, 'Per quante persone vuoi prenotare?');
            update_post_meta( $plugin_post_id, 'telegram_custom_state', 'tablenumber_wait' );
            die(); //You can comment this if you want to parse other commands
        }
    }
        return;
    }
    

    now in the telegram subscriber I have the issue that when I insert the. umber of person when command Prenota is sent I have custom field “telegram_custom_state” set to value “tablenumber_wait” where am I wrong?

    how I can add when (date and time) book the table and sent an automatic email to a specified email address?

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘send email and get phone number’ is closed to new replies.